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 |
100題留念~#include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #define LL long long int main(){ LL n,addup,son,parent,last; while(scanf("%lld", &n)!=EOF){ LL sum =0; for(int i=1;;i++){ sum+=i; if(sum >=n){last= sum-i; addup = i+1; break;} } if(addup%2==0){ parent = n - last; son = addup-parent; } else{ son = n - last; parent = addup-son; } printf("TERM %lld IS %lld/%lld\n", n,son,parent); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator