很疑惑,思路应该也没错,但是WA,求助大佬

P2669 [NOIP2015 普及组] 金币

Haidde @ 2024-02-04 20:59:38

#include<stdio.h>
int main()
{
    int i,c=1,q=1;
    long int k,s;
    scanf("%ld",&k);
    for(i=1;i<=k;i++)
      {
        s+=c;
        q--;
        if(q==0)
         {
           c++;
           q=c;
          }
       }
       printf("%ld",s);

    return 0;

}

by ICU152_QWQ_IS8 @ 2024-02-04 21:04:17

@Haidde s初始化


by Ja50nY0un9_as_AgNO3 @ 2024-02-04 21:04:41

@Haidde


by Haidde @ 2024-02-05 11:43:41

@ICU152_QWQ_IS8 好的,谢谢大佬


by Haidde @ 2024-02-05 11:44:18

@Ja50nY0un9_as_AgNO3 好的,谢谢大佬


|