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 |
等差项数数列分组后模拟 0MS 过 附代码#include<iostream> using namespace std; int main() { int n,t,count1,count2; while( scanf("%d",&t) != EOF ) { n = 1; count1 = count2 = 0; while( count1 != t ) { count1++; count2++; if( count2 == n ) { if( count1 != t ) { count2 = 0; n++; } } } if( n % 2 == 0 ) cout<<"TERM "<<t<<" IS "<<count2<<"/"<<n-count2+1<<endl; else cout<<"TERM "<<t<<" IS "<<n-count2+1<<"/"<<count2<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator