第一眼看到题目傻了
第二眼觉得第一眼的自己很笨
就是一个直接映射的行列关系啦
#include<stdio.h>
int up, down;
void rowANDcol(int N) {
int s = 1, tmpN = N;
while (tmpN > 0) {
tmpN -= s;
if (tmpN <= 0)
break;
s++;
}
int row, col, more = tmpN + s;
if (s % 2 == 0) {
row = more;
col = s - more + 1;
}
else {
row = s - more + 1;
col = more;
}
up = row;
down = col;
}
int main() {
int N;
scanf_s("%d", &N);
rowANDcol(N);
printf("%d/%d", up, down);
return 0;
}