fgufct

何松羽  •  21天前


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

cout << c; 
return 0; 
}


评论: