Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
初一中学生搞出来的简单精度题,2次性AC有点惭愧啊,贴代码#include <stdio.h> #include <stdlib.h> float a,b=0.0,c,d; int e; int aa[100001]; int f; int main () { f=2; int g=0; while(1){ scanf("%f",&a); if(a==0.0)break; while(b<=a){b+=1.0/f; g++; f++; if(b>=a){aa[e]=g; e++; b=0.0; g=0; f=2; break; } } } for(int h=0;h<e;h++){ printf("%d card(s)\n",aa[h]); } system("pause"); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator