1 solutions

  • 0
    @ 2023-1-17 14:24:32
    #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项的值是多少?

    Information

    ID
    588
    Time
    1000ms
    Memory
    16MiB
    Difficulty
    10
    Tags
    # Submissions
    6
    Accepted
    2
    Uploaded By