Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
38852 | 奚晨瑞 | 奇数求和 | C++ | Accepted | 0 MS | 252 KB | 253 | 2024-01-28 17:19:50 |
#include<iostream> using namespace std; int main() { int m,n,s,t; cin>>m>>n; if(m%2==0){ s=m+1; } else{ s=m; } if(n%2==0){ t=n+1; } else{ t=n; } int A=0; while(s<=t){ A+=s; s+=2; } cout<<A; return 0; }