Submission #305954
Source Code Expand
#include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; void work(long long k) { long long i = (sqrt(4+8*(double)k)-2)/4; k -= 2 * i * (i+1); i++; long long x = (k+1)/2-i, y = i-abs(x); if(k & 1) y = -y; printf("%lld %lld\n", x, y); } int main() { int n; long long k; scanf("%d",&n); while(n--) { scanf("%lld",&k); if(k == 1) printf("0 0\n"); else work(k - 2); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - n-th Points |
User | asian-2014-1517 |
Language | C++ (G++ 4.6.4) |
Score | 100 |
Code Size | 461 Byte |
Status | AC |
Exec Time | 114 ms |
Memory | 804 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:21:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] ./Main.cpp:24:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_sample_01.txt |
All | subtask0_sample_01.txt, subtask1_large_01.txt, subtask1_mini01.txt, subtask1_random01.txt, subtask1_random02.txt, subtask1_random03.txt, subtask1_random04.txt, subtask1_random05.txt, subtask1_random06.txt, subtask1_random07.txt, subtask1_random08.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
subtask0_sample_01.txt | AC | 22 ms | 760 KB |
subtask1_large_01.txt | AC | 99 ms | 796 KB |
subtask1_mini01.txt | AC | 79 ms | 800 KB |
subtask1_random01.txt | AC | 84 ms | 748 KB |
subtask1_random02.txt | AC | 84 ms | 792 KB |
subtask1_random03.txt | AC | 86 ms | 800 KB |
subtask1_random04.txt | AC | 112 ms | 800 KB |
subtask1_random05.txt | AC | 113 ms | 804 KB |
subtask1_random06.txt | AC | 112 ms | 656 KB |
subtask1_random07.txt | AC | 114 ms | 800 KB |
subtask1_random08.txt | AC | 111 ms | 796 KB |