| ||||||||||
| 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 | |||||||||
Re:100題留念~In Reply To:100題留念~ Posted by:ytlau9 at 2011-01-09 20:51:08 > #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