ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213125 | #2348. Life | chendongyu | 100 | 4240ms | 1436kb | C++ | 591b | 2024-11-09 20:35:34 | 2024-11-09 23:16:25 |
answer
#include<bits/stdc++.h>
using namespace std;
long long ans[10500][3];
int main()
{
long long L,Q,x;
scanf("%lld%lld",&L,&Q);
for(int i=0;i<10500;i++)
ans[i][0]=ans[i][1]=ans[i][2]=L+1;
for(long long i=-L;i<=L;i++)
for(long long j=i;j<=L;j++)
for(long long k=j;k<=L;k++)
{
long long s=i*i*i+j*j*j+k*k*k;
if(0<=s&&s<=10000)
if(max(abs(i),abs(k))<max(abs(ans[s][0]),abs(ans[s][2])))
ans[s][0]=i,ans[s][1]=j,ans[s][2]=k;
}
while(Q--)
{
scanf("%lld",&x);
printf("%lld %lld %lld\n",ans[x][0],ans[x][1],ans[x][2]);
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1436kb
input:
98 10 5487 1899 3043 5373 2368 3993 723 9567 6812 901
output:
-1 14 14 -13 0 16 -30 -21 34 -22 13 24 -12 0 16 11 11 11 -77 58 64 -28 12 31 -13 16 17 -11 -8 14
result:
ok Correct!
Test #2:
score: 10
Accepted
time: 3ms
memory: 1436kb
input:
99 10 6139 3749 7532 3544 3976 345 522 8442 6400 7965
output:
100 100 100 100 100 100 -5 14 17 -7 8 15 -49 -15 50 1 1 7 -11 5 12 -11 8 21 -24 -12 28 -4 13 18
result:
ok Correct!
Test #3:
score: 10
Accepted
time: 0ms
memory: 1436kb
input:
98 10 5078 9597 9394 9368 8777 6955 8020 5115 398 3771
output:
99 99 99 99 99 99 2 5 21 -27 -24 35 -29 15 31 -22 3 26 -9 -8 21 -14 10 19 -11 9 10 3 10 14
result:
ok Correct!
Test #4:
score: 10
Accepted
time: 0ms
memory: 1436kb
input:
91 10000 163 6364 2583 7101 5320 483 6442 1028 1209 1710 5617 296 7228 1593 4580 5559 9699 2015 6397...
output:
-26 -21 30 -20 13 23 7 8 12 -27 -6 30 4 7 17 -13 -4 14 92 92 92 1 3 10 -11 7 13 -52 -35 57 -6 1 18 -...
result:
ok Correct!
Test #5:
score: 10
Accepted
time: 5ms
memory: 1432kb
input:
91 10000 6480 8776 1711 1745 4845 3338 343 3167 8450 2756 2252 4375 4912 9822 8053 1533 1216 4161 61...
output:
-44 26 42 -8 3 21 -12 4 15 -12 9 14 -20 13 22 -4 3 15 -7 7 7 -6 2 15 -13 -1 22 6 7 13 92 92 92 0 10 ...
result:
ok Correct!
Test #6:
score: 10
Accepted
time: 2ms
memory: 1436kb
input:
95 10000 91 6885 8279 384 5310 2877 4483 2176 267 393 5446 7415 3853 4223 8480 3368 6752 9898 5779 7...
output:
0 3 4 -1 3 19 -4 7 20 -4 -4 8 -11 12 17 2 5 14 -5 8 16 -4 8 12 -10 -4 11 96 96 96 7 12 15 -49 4 50 -...
result:
ok Correct!
Test #7:
score: 10
Accepted
time: 1127ms
memory: 1432kb
input:
952 10000 2160 9764 2079 4616 9459 4653 4400 6373 2089 7189 4202 4497 6684 119 1191 2206 9287 5365 1...
output:
6 6 12 -22 9 27 2 7 12 8 9 15 -24 11 28 -16 -8 21 -9 6 17 -234 -150 253 -96 -96 121 -13 5 21 9 9 14 ...
result:
ok Correct!
Test #8:
score: 10
Accepted
time: 1162ms
memory: 1432kb
input:
992 10000 2576 3876 8352 3311 9101 5255 5420 145 7396 6040 8529 9794 5164 4302 7147 3683 152 1136 79...
output:
-14 -8 18 -37 -7 38 4 15 17 -4 0 15 -11 -6 22 -1 7 17 -42 1 43 -8 -7 10 -9 5 20 6 12 16 -355 -115 35...
result:
ok Correct!
Test #9:
score: 10
Accepted
time: 973ms
memory: 1436kb
input:
996 10000 2189 8757 4831 6765 991 2216 9313 7968 7020 9945 988 9422 7315 2132 2333 5962 1798 8184 22...
output:
-2 0 13 -8 2 21 5 11 15 -31 23 29 -2 -1 10 6 10 10 -391 -97 393 -14 4 22 -26 17 27 -39 7 41 -7 0 11 ...
result:
ok Correct!
Test #10:
score: 10
Accepted
time: 968ms
memory: 1432kb
input:
988 10000 1785 1065 1261 3054 2475 693 9109 9404 1153 4364 1847 8539 4364 9471 6183 6855 303 306 635...
output:
-23 -20 28 1 4 10 -10 4 13 -833 274 823 -37 24 34 -56 44 45 -6 4 21 -19 16 23 -42 33 34 -13 9 18 -92...
result:
ok Correct!
Extra Test:
score: 0
Extra Test Passed