<<bu hui>>

P2669 [NOIP2015 普及组] 金币

liujihan @ 2024-11-03 22:30:54

咋做!!!!!(就俩字)


by liujihan @ 2024-11-03 22:42:42

include<iostream>

using namespace std; int main(){ int k,coin = 0,day = 0; cin << k; for(int i = 1;;i++) for(int j = 1;j <= i;j++){ coin += i;days++; if(day == k){ cout << coin << endl; return 0; } } return 0; }



哪错了?

by qiminghaonan @ 2024-11-03 22:48:37

望丰展?用MD。


by liujihan @ 2024-11-08 20:24:54

#include<iostream> 
using namespace std;
int main(){ 
    int k,coin = 0,day = 0;
        cin << k; 
        for(int i = 1;;i++)
            for(int j = 1;j <= i;j++){ 
            coin += i;days++;
            if(day == k){
            cout << coin << endl; 
            return 0; 
            }
            return 0; 
            }

|