Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- long long n,diag_pos,print_n,lob,hor;
- while(scanf("%lld",&n)!=EOF)
- {
- print_n = n;
- for(diag_pos=1;n>diag_pos;diag_pos++)
- {
- n-=diag_pos;
- }
- if(diag_pos%2)
- {
- lob = diag_pos - n + 1;
- }
- else
- {
- lob = n;
- }
- hor = diag_pos+1-lob;
- printf("TERM %lld IS %lld/%lld\n",print_n,lob,hor);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment