1 solutions

  • 1
    @ 2025-7-8 10:29:02
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	cin>>n;
    	int s=0,h=0;
    	for(int i=1;i<=n;i+=2){
    		h+=i;
    	}
    	for(int c=0;c<=n;c+=2){
    		s+=c;
    	}
    	cout<<s<<" "<<h;
    	return 0;
    }
    
    
    
    • 1

    Information

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