Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
119308 金昱帆 13求1+2-3+4-5+……n的值 C++ Compile Error 0 MS 0 KB 238 2025-05-17 13:05:20

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n; int a=1; cin>>n; for(int i=2;i<=n;i++){ if(i%2==0){ a=a+i; } else{ a=a-i; } } cout<<a; return 0


Run Info:

Main.cc: In function 'int main()':
Main.cc:13:12: error: expected ';' at end of input
     return 0
            ^
Main.cc:13:12: error: expected '}' at end of input