题目不复述了,自己看吧。http://www.spoj.com/problems/CANTON/一如既往的暴力。。
#include<cstdio> int n,i,j,s,ans; int main(){ scanf("%d",&n); while(n--){ scanf("%d",&s); printf("TERM %d IS ",s); for (i=1;s>i;i++){ s-=i; } if (i&1) printf("%d/%d\n",i-s+1,s);else printf("%d/%d\n",s,i-s+1); } }