3 条题解

  • 0
    @ 2023-10-5 22:29:01
    #include <iostream>
    using namespace std;
    int main()
    {
        int n, sum = 0;
        cin >> n;
        for(int i = 1; i <= n; i++)
        {
            sum += i;
            if(sum >= n)
            {
                cout << i;
                return 0;
            }
        }
    }
    
    • 0
      @ 2023-10-3 22:06:32

      简单粗暴的代码

      #include<bits/stdc++.h>
      using namespace std;
      int main(){
          cout<<14;
          return 0;
      }
      
      • 0
        @ 2023-1-17 14:24:06
        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
        	int n;
        	cin >> n;
        	int s = 0;
        	for(int i = 1; i <= n; i++){
        		s += i;
        		if(s >= n){
        			cout << i;
        			break;
        		}
        	}
        	return 0;
        }
        
        
        • 1

        【入门】求数列的第n项的值是多少?

        信息

        ID
        248
        时间
        1000ms
        内存
        16MiB
        难度
        1
        标签
        递交数
        62
        已通过
        45
        上传者