1 solutions
-
0
C :
#include<stdio.h> #include<math.h> int main() { int n; scanf("%d", &n); int k = 1, s = 0; for(;;) { s += k; if(s >= n) { printf("%d/%d\n", s-n+1, k-s+n); break; } k++; } return 0; }
C++ :
#include<stdio.h> #include<math.h> int main() { int n; scanf("%d", &n); int k = 1, s = 0; for(;;) { s += k; if(s >= n) { printf("%d/%d\n", s-n+1, k-s+n); break; } k++; } return 0; }
- 1
Information
- ID
- 485
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By