求助 零分全错

P2669 [NOIP2015 普及组] 金币

wxli1011 @ 2019-04-22 20:58:58

include <cstdio>

using namespace std; int main( ) { int k; scanf("%d",&k); long long sum = 0; int cur = 1; int rst = 1; for(int i = 1; i <= 0; i++) { sum += cur; rst--; if(rst == 0) { cur++; rst = cur; } } printf("%lld\n",sum); return 0; }


by Hyscere @ 2019-04-22 21:08:46

希更展?用md


by Luvwgyx @ 2019-04-22 21:09:13

希更展?用md


by LiGuanlin1124 @ 2019-04-22 21:20:34

?m


by Raw_Aya9285 @ 2019-04-25 20:24:47

代码还原:


include <cstdio>
using namespace std;
int main( ) {
   int k;
   scanf("%d",&k); 
   long long sum = 0;
   int cur = 1; 
   int rst = 1; 
   for(int i = 1; i <= 0; i++) { 
      sum += cur;
      rst--;
      if(rst == 0) {
      cur++;
      rst = cur; 
        } 
      }
      printf("%lld\n",sum); 
      return 0; 
 }

by 已注销HeBhs37KwrDer @ 2019-07-25 13:58:40

#include <iostream>
#include <cstdio>
using namespace std;
int main( )
{
    int k;
    scanf("%d",&k); 
    long long sum = 0;
    int cur = 1; 
    int rst = 1; 
    for(int i = 1; i <= k; i++)
    { 
      sum += cur;
      rst--;
      if(rst == 0) {cur++;rst = cur; } 
    }
    printf("%lld\n",sum); 
    return 0;
}

你把

for(int i = 1; i <= k; i++)

写成了

for(int i = 1; i <= 0; i++)


|