5 条题解

  • 0
    @ 2023-10-27 21:12:06

    A了

    #include<iostream>
    using namespace std;
    int main()
    {
    	int n, i, a, b, t,m;
    	cin >> n;
    	i = a = b = t = 1;
    	m = 0;
    	while(i <= n){
    		if(i <= a){
    			m += b;
    		}
    		else if(i > a){
    			t++;
    			a += t;
    			b++;
    			m += b;
    		}
    		i++;
    	}
    	cout << m;
    	return 0;
    }
    
    • -1
      @ 2024-5-21 20:45:18

      AC哥来了 #include<iostream> using namespace std; int main() { int n, i, a, b, t,m; cin >> n; i = a = b = t = 1; m = 0; while(i <= n){ if(i <= a){ m += b; } else if(i > a){ t++; a += t; b++; m += b; } i++; } cout << m; return 0; }

      • -1
        @ 2024-5-2 16:48:49
        #include<iostream>
        using namespace std;
        int main()
        {
            int k,n=1;
            long long num=0;
            cin >> k;
            while(k>0)
            {
                if(k>=n)
                {
                    num+=n*n;
                    k-=n;
                    n++;
                }
                else
                {
                    num+=k*n;
                    k=0;
                }
            }
            cout << num;
            return 0;
        }
        点个赞呗~
        
        • -1
          @ 2023-12-9 20:37:41
          #include<iostream>
          int main()
          {
              int k;
              int sum=0,v=1;
              std::cin>>k;
              for(int i=1;k>=v;i+=1)
              {
                  k-=v;
                  sum+=v*v;
                  v+=1;
              }
              sum+=k*v;
              std::cout<<sum;
          }
          
          • -1
            @ 2023-10-27 21:46:31
            #include <iostream>
            int main(){
                int n=1,sum=0,day; std::cin>>day;
                while(day>=n){
                    sum+=n*n;
                    day-=n; n++;}
                std::cout<<sum+day*n; return 0;}
            
            • 1

            信息

            ID
            523
            时间
            1000ms
            内存
            256MiB
            难度
            5
            标签
            递交数
            1365
            已通过
            551
            上传者