== 감 ==
각 기 .
결국 길고... -..ㅡ;;
각 기 .
결국 길고... -..ㅡ;;
¶
~cpp
#include <iostream>
using namespace std;
int x, y;
void firstStep(int count, int &start, int input)
{
for(; count>0; count--){
x--;
y++;
if(start == input) break;
start++;
}
}
void secondStep(int count, int &start, int input)
{
for(; count>0; count--){
x--;
if(start == input) break;
start++;
}
}
void thirdStep(int count, int &start, int input)
{
for(; count>0; count--){
y--;
if(start == input) break;
start++;
}
}
void firthStep(int count, int &start, int input)
{
for(; count>0; count--){
x++;
y--;
if(start == input) break;
start++;
}
}
void fifthStep(int count, int &start, int input)
{
for(; count>0; count--){
x++;
if(start == input) break;
start++;
}
}
void sixthStep(int count, int &start, int input)
{
for(; count>0; count--){
y++;
if(start == input) break;
start++;
}
}
void process(int input)
{
int count = 0;
for(count; count<100000; count++)
{
if((3*(count*count + count) + 1) >= input)
break;
}
x = count;
y = 0;
int start = (3*(count*count + count)+1) - 6*count + 1;
int index = (input-start)/count + 1;
for(int i = 1; i<=index; i++)
{
switch(i)
{
case 1:
firstStep(count,start,input);
break;
case 2:
secondStep(count,start,input);
break;
case 3:
thirdStep(count,start,input);
break;
case 4:
firthStep(count,start,input);
break;
case 5:
fifthStep(count,start,input);
break;
case 6:
sixthStep(count,start,input);
break;
}
}
cout << x << " " << y << endl;
}
int main()
{
int input;
while(cin >>input) {
process(input);
}
return 0;
}










