2 条题解

  • 1
    @ 2025-7-15 10:07:29
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n,k=0,t=1;
    	cin>>n;
    	while(n!=0)
    	{
    		for(int i=1;i<=t;i++)
    		{
    			k+=t;
    			n-=1;
    			if(n==0)
    			{
    				cout<<k;
    				return 0;	
    			}
    		}
    		t++;
    	}
    	return 0;
    }
    
    • -1
      @ 2025-5-4 13:34:31

      Easy

      #include<bits/stdc++.h>
      using namespace std;
      
      int main()
      {
      	long long k,s=0,day=0,week=1;
      	cin>>k;
      	for(int i=1;i<=k;i++)
      	{
      		s+=week;
      		day++;
      		if(day==week)
      		{
      			week++;
      			day=0;
      		}
      	}
      	cout<<s;
      	return 0;
      }
      
      
      • 1

      信息

      编号
      2341
      时间
      1000ms
      内存
      256MiB
      难度
      4
      标签
      递交数
      38
      已通过
      24
      上传者