Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
2734 | A班-许锘林 | 奇妙的数列 | C++ | 运行超时 | 16 | 1000 MS | 260 KB | 351 | 2024-12-21 11:06:19 |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int a[n],b[n]; for(int i = 0;i < n;i++) { cin>>a[i]>>b[i]; int temp = 0; for(int j = a[i];j <= b[i];j++) { if(j % 2 == 1) { temp += j * -1; } else { temp += j; } } cout<<temp<<endl; } return 0; }