ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#186494 | #3343. Huge Number | chendongyu | 100 | 2456ms | 1196kb | C++11 | 496b | 2023-10-01 09:05:38 | 2023-10-01 12:05:43 |
answer
#include<bits/stdc++.h>
using namespace std;
int n,o;
long long c5=0,c2=0,ans=1;
void fun(int s)
{
while(!(s&1))
{
c2+=1;
s>>=1;
}
while(!(s%5))
{
c5+=1;
s/=5;
}
o=s;
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
fun(i);
ans=ans*o%10;
}
if(c5>c2)
{
cout<<c2<<" ";
for(int i=1;i<=c5-c2;i++)
ans=ans*5%10;
cout<<ans;
}
else
{
cout<<c5<<" ";
for(int i=1;i<=c2-c5;i++)
ans=(ans<<1)%10;
cout<<ans;
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 5
Accepted
time: 0ms
memory: 1192kb
input:
3637
output:
907 8
result:
ok single line: '907 8'
Test #2:
score: 5
Accepted
time: 0ms
memory: 1196kb
input:
4489
output:
1119 2
result:
ok single line: '1119 2'
Test #3:
score: 5
Accepted
time: 0ms
memory: 1192kb
input:
4005
output:
1000 2
result:
ok single line: '1000 2'
Test #4:
score: 5
Accepted
time: 0ms
memory: 1196kb
input:
3713
output:
925 6
result:
ok single line: '925 6'
Test #5:
score: 5
Accepted
time: 0ms
memory: 1192kb
input:
459
output:
112 4
result:
ok single line: '112 4'
Test #6:
score: 5
Accepted
time: 0ms
memory: 1192kb
input:
3041
output:
757 2
result:
ok single line: '757 2'
Test #7:
score: 5
Accepted
time: 0ms
memory: 1196kb
input:
426
output:
105 4
result:
ok single line: '105 4'
Test #8:
score: 5
Accepted
time: 0ms
memory: 1192kb
input:
4003
output:
999 6
result:
ok single line: '999 6'
Test #9:
score: 5
Accepted
time: 0ms
memory: 1192kb
input:
4249
output:
1058 6
result:
ok single line: '1058 6'
Test #10:
score: 5
Accepted
time: 0ms
memory: 1196kb
input:
1050
output:
261 4
result:
ok single line: '261 4'
Test #11:
score: 5
Accepted
time: 448ms
memory: 1192kb
input:
49676662
output:
12419161 8
result:
ok single line: '12419161 8'
Test #12:
score: 5
Accepted
time: 152ms
memory: 1192kb
input:
16892193
output:
4223043 4
result:
ok single line: '4223043 4'
Test #13:
score: 5
Accepted
time: 438ms
memory: 1192kb
input:
48829352
output:
12207335 6
result:
ok single line: '12207335 6'
Test #14:
score: 5
Accepted
time: 433ms
memory: 1196kb
input:
48398196
output:
12099542 4
result:
ok single line: '12099542 4'
Test #15:
score: 5
Accepted
time: 48ms
memory: 1196kb
input:
5295003
output:
1323746 8
result:
ok single line: '1323746 8'
Test #16:
score: 5
Accepted
time: 47ms
memory: 1196kb
input:
5148001
output:
1286996 4
result:
ok single line: '1286996 4'
Test #17:
score: 5
Accepted
time: 81ms
memory: 1192kb
input:
8927071
output:
2231762 4
result:
ok single line: '2231762 4'
Test #18:
score: 5
Accepted
time: 95ms
memory: 1192kb
input:
10907881
output:
2726966 4
result:
ok single line: '2726966 4'
Test #19:
score: 5
Accepted
time: 309ms
memory: 1196kb
input:
34369970
output:
8592485 8
result:
ok single line: '8592485 8'
Test #20:
score: 5
Accepted
time: 405ms
memory: 1192kb
input:
44959421
output:
11239851 2
result:
ok single line: '11239851 2'