4 solutions

  • 1
    @ 2026-8-6 15:39:02
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
    	cin>>n;
    	int s=0;
    	int t=1;
    	while(t<=n)
    	{
    		s=s+t;
    		t++;
    	}
    	cout<<s;
    	return 0; 
    }
    
    • 0
      @ 2025-7-8 9:57:46
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int n,s=0;
          cin>>n;
          for(int i=1;i<=n;i++)
          {
              s+=i;
          }
          cout<<s;
          return 0;
      }
      
      • -5
        @ 2024-7-5 11:12:50

        1+1=?

        • -6
          @ 2024-5-26 10:56:09

          怎么了

        • 1

        Information

        ID
        46
        Time
        1000ms
        Memory
        256MiB
        Difficulty
        1
        Tags
        (None)
        # Submissions
        290
        Accepted
        110
        Uploaded By