Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
127149 唐洪盛 13求1+2-3+4-5+……n的值 C++ Compile Error 0 MS 0 KB 228 2025-07-24 16:49:42

Tests(0/0):


Code:

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


Run Info:

Main.cc: In function 'int main()':
Main.cc:12:3: error: expected ';' before '}' token
   }
   ^