Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
100759 | 谭思宸 | 13奇数和与偶数和 | C++ | Compile Error | 0 MS | 0 KB | 319 | 2024-12-12 20:26:14 |
#include<iostream> using namespace std; int main() { long long n,sum1=0,sum2=0; cin>>n; for(int i=1;,j=2;j<=n;i+=2,j+=2) { sum1+=i; sum2+=j; } if(n%2!=0) sum1+=n; cout<<sum1<<" "<<sum2<<endl; return 0; }
Main.cc: In function 'int main()': Main.cc:7:20: error: expected primary-expression before ',' token for(int i=1;,j=2;j<=n;i+=2,j+=2) ^ Main.cc:7:21: error: 'j' was not declared in this scope for(int i=1;,j=2;j<=n;i+=2,j+=2) ^ Main.cc:7:29: error: expected ')' before ';' token for(int i=1;,j=2;j<=n;i+=2,j+=2) ^ Main.cc:7:16: warning: unused variable 'i' [-Wunused-variable] for(int i=1;,j=2;j<=n;i+=2,j+=2) ^ Main.cc:7:30: error: 'i' was not declared in this scope for(int i=1;,j=2;j<=n;i+=2,j+=2) ^ Main.cc:7:35: error: 'j' was not declared in this scope for(int i=1;,j=2;j<=n;i+=2,j+=2) ^