코드 ¶
~cpp #include <iostream> #include <cmath> using namespace std; int findLine(int input) { double num = ceil((double)sqrt(input)) ; return (int)num; } void process(int input) { int line = findLine(input); int num = line*line; for( int i = 1; i<=(2*line); i++) { if(input == num - i + 1) break; } if(i >= line) cout << line << " " << 2*line - i <<endl; else cout << i << " " << line <<endl; } int main() { int input; while(cin >> input) { if(input == 0) break; process(input); } return 0; }