重生之女大学生吊儿郎当学代码

 1.成绩

#include<bits/stdc++.h>
using namespace std;

int main()
{
	int grade;
	cin>>grade;
	if (grade>=85) cout<<'A'<<endl;
	else if(grade>=70) cout<<'B'<<endl;
	else if(grade>=60) cout<<'C'<<endl;
	else cout<<'D'<<endl;
    return 0;
}

2.加减乘除

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	char c;
	cin >> a >> b >> c;
	if(c == '+') cout << a+b <<endl;
	else if(c == '-') cout << a-b << endl;
    else if( c =='*') cout << a*b << endl;
	else if( c== '/', b == 0)
		cout << "Divided by zero!"<<endl;
		else cout << "Invaild operator!"<<endl;
	return 0;

3.闰年的计算

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int year;
	cin >> year;
	if(year %100 ==0)
	{
		if(year%400==0)
		cout << "yes" <<endl;
	}	
	else
		if(year%4==0) cout<<"yes"<<endl;
        else cout<<"No"<<endl;
	return 0;
}

可以使用Apache POI库来实现多线程的千万数据的Excel导出,具体实现可以参考以下代码: ``` public class ExcelExporter implements Runnable { private int startRow; private int endRow; private String fileName; public ExcelExporter(int startRow, int endRow, String fileName) { this.startRow = startRow; this.endRow = endRow; this.fileName = fileName; } @Override public void run() { try { Workbook workbook = new XSSFWorkbook(); Sheet sheet = workbook.createSheet("Sheet1"); // 创建表头 Row headerRow = sheet.createRow(); for (int i = ; i < headers.length; i++) { Cell cell = headerRow.createCell(i); cell.setCellValue(headers[i]); } // 填充数据 for (int i = startRow; i <= endRow; i++) { Row row = sheet.createRow(i - startRow + 1); for (int j = ; j < data[i].length; j++) { Cell cell = row.createCell(j); cell.setCellValue(data[i][j]); } } // 导出Excel文件 FileOutputStream outputStream = new FileOutputStream(fileName); workbook.write(outputStream); outputStream.close(); } catch (Exception e) { e.printStackTrace(); } } } // 创建线程池 ExecutorService executorService = Executors.newFixedThreadPool(10); // 分批导出Excel文件 int batchSize = 100000; for (int i = ; i < data.length; i += batchSize) { int startRow = i; int endRow = Math.min(i + batchSize - 1, data.length - 1); String fileName = "data_" + startRow + "_" + endRow + ".xlsx"; executorService.execute(new ExcelExporter(startRow, endRow, fileName)); } // 关闭线程池 executorService.shutdown(); while (!executorService.isTerminated()) { Thread.sleep(100); } ```
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值