9 solutions

  • 0
    @ 2025-8-14 14:06:49
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int n;
    	cin>>n;
    	int j=0,o=0;
    	for(int i=1;i<=n;i++){
    		if(i%2==0){
    			o+=i;
    		}else{
    			j+=i;
    		}
    	}
    	cout<<o<<' '<<j;
    	return 0;
    }
    

    Information

    ID
    2833
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    # Submissions
    40
    Accepted
    20
    Uploaded By