ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#211109 | #3800. 蛋糕 | rua | 100 | 637ms | 5032kb | C++11 | 5.1kb | 2024-08-09 11:48:31 | 2024-08-09 12:50:09 |
answer
#include <bits/stdc++.h>
#define inf INT_MAX
#define NN INT_MIN
typedef long long ll;
using namespace std;
int l, t, tmp;
int vis[1000006];
#ifdef ONLINE_JUDGE
#define getchar getchar_unlocked
#endif
namespace FastIO
{
char write_cache[40];
template <class T>
inline const T read() noexcept
{
T x(0);
char ch(getchar());
bool f(0);
while (ch < '0' || ch > '9')
f ^= ch == '-', ch = getchar();
while (ch >= '0' && ch <= '9')
x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
return f ? -x : x;
}
template <class T>
inline const void read(T &x) noexcept
{
x = 0;
char ch(getchar());
bool f(0);
while (ch < '0' || ch > '9')
f ^= ch == '-', ch = getchar();
while (ch >= '0' && ch <= '9')
x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
x = f ? -x : x;
}
template <class T, class... P>
inline const void read(T &x, P &...ark) noexcept
{
x = 0;
char ch(getchar());
bool f(0);
while (ch < '0' || ch > '9')
f ^= ch == '-', ch = getchar();
while (ch >= '0' && ch <= '9')
x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
x = f ? -x : x;
read(ark...);
}
template <class T>
inline const void readu(T &x) noexcept
{
x = 0;
char ch(getchar());
bool f(0);
while (ch < '0' || ch > '9')
ch = getchar();
while (ch >= '0' && ch <= '9')
x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
}
template <class T>
inline const T readu() noexcept
{
T x(0);
char ch(getchar());
bool f(0);
while (ch < '0' || ch > '9')
ch = getchar();
while (ch >= '0' && ch <= '9')
x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
return x;
}
template <class T, class... P>
inline const void readu(T &x, P &...ark) noexcept
{
x = 0;
char ch(getchar());
bool f(0);
while (ch < '0' || ch > '9')
ch = getchar();
while (ch >= '0' && ch <= '9')
x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
readu(ark...);
}
template <class T>
inline const void readArr(T *begin, T *end) noexcept
{
while (begin < end)
{
*begin = 0;
char ch(getchar());
bool f(0);
while (ch < '0' || ch > '9')
f ^= ch == '-', ch = getchar();
while (ch >= '0' && ch <= '9')
*begin = (*begin << 1) + (*begin << 3) + (ch ^ 48), ch = getchar();
*begin = f ? -*begin : *begin;
}
}
template <class T>
inline const void readArr(T *begin, int cnt) noexcept
{
while (cnt--)
{
read(*begin);
++begin;
}
}
template <class T>
inline const void write(T x) noexcept
{
if (x < 0)
putchar('-'), x = -x;
int cnt = 0;
while (x)
write_cache[cnt++] = x % 10 ^ 48, x /= 10;
if (!cnt)
putchar('0');
else
while (cnt--)
putchar(write_cache[cnt]);
}
template <char end = ' ', class T, class... ARK>
inline const void write(T &x, ARK &...ark) noexcept
{
write(x);
putchar(end);
write(ark...);
}
template <char end = '\n', class T>
inline const void println(T x) noexcept
{
if (x < 0)
putchar('-'), x = -x;
int cnt = 0;
while (x)
write_cache[cnt++] = x % 10 ^ 48, x /= 10;
if (!cnt)
putchar('0');
else
while (cnt--)
putchar(write_cache[cnt]);
putchar(end);
}
template <char sep = ' ', char endl = '\n', class T>
inline const void writeArr(T *begin, T *end) noexcept
{
while (begin < end)
write(*begin), putchar(sep), ++begin;
putchar(endl);
}
template <char sep = ' ', char end = '\n', class T>
inline const void writeArr(T *arr, int cnt)
{
while (cnt--)
{
write(*arr);
putchar(sep);
++arr;
}
putchar(end);
}
}
void solve(int mo, int now)
{
if (mo == 0)
return;
if (vis[mo] == 1)
{
putchar(')');
return;
}
if (now == tmp + 1)
putchar('(');
FastIO::write((mo * 10) / t);
vis[mo] = 1;
solve(mo * 10 % t, now + 1);
}
int main()
{
#ifdef WHX_AK_IOI
freopen("data.in", "r", stdin);
// freopen("dataout.txt","w",stdout);
#endif
for (int i = 1; i <= 18; i++)
{
memset(vis, 0, sizeof vis);
FastIO::read(l, t);
int g = __gcd(l, t);
l /= g, t /= g;
ll p = t, cnt2 = 0, cnt5 = 0;
while (p % 2 == 0 && p != 0)
p /= 2, cnt2++;
while (p % 5 == 0 && p != 0)
p /= 5, cnt5++;
double ans = (long double)l / t;
int tans = l / t;
tmp = max(cnt2, cnt5);
FastIO::write(tans);
if (l % t != 0)
{
putchar('.');
solve(l % t, 1);
}
puts("");
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 5
Accepted
time: 4ms
memory: 5028kb
input:
85 85 59 59 52 52 96 12 62 31 48 24 85 85 85 85 69 69 76 38 72 24 54 27 100 20 72 72 42 42 81 81 78 ...
output:
1 1 1 8 2 2 1 1 1 2 3 2 5 1 1 1 1 1
result:
ok 18 tokens
Test #2:
score: 5
Accepted
time: 3ms
memory: 5028kb
input:
9696 9696 9036 9036 4771 4771 7751 7751 9073 9073 9085 9085 6444 358 4581 4581 8505 8505 8028 2007 9...
output:
1 1 1 1 1 1 18 1 1 4 2 5 2 1 1 1 1 1
result:
ok 18 tokens
Test #3:
score: 5
Accepted
time: 5ms
memory: 5032kb
input:
648044 648044 949839 949839 401844 401844 916962 916962 875649 875649 227737 227737 827552 827552 64...
output:
1 1 1 1 1 1 1 1 1 1 2 7 2 2 5 2 1 2
result:
ok 18 tokens
Test #4:
score: 5
Accepted
time: 5ms
memory: 5028kb
input:
37 25 43 10 56 10 47 2 50 50 66 80 34 50 3 8 56 1 49 10 97 5 10 1 76 40 52 50 70 5 26 1 97 32 32 64
output:
1.48 4.3 5.6 23.5 1 0.825 0.68 0.375 56 4.9 19.4 10 1.9 1.04 14 26 3.03125 0.5
result:
ok 18 tokens
Test #5:
score: 5
Accepted
time: 6ms
memory: 5032kb
input:
451 100 844 50 744 100 874 8 19 625 443 400 415 512 766 625 189 5 71 128 247 80 307 640 395 160 101 ...
output:
4.51 16.88 7.44 109.25 0.0304 1.1075 0.810546875 1.2256 37.8 0.5546875 3.0875 0.4796875 2.46875 6.31...
result:
ok 18 tokens
Test #6:
score: 5
Accepted
time: 4ms
memory: 5032kb
input:
7819 400 2868 512 4833 800 6024 6250 3285 8000 9721 125 4037 6250 8159 1250 4544 3125 6659 5000 8331...
output:
19.5475 5.6015625 6.04125 0.96384 0.410625 77.768 0.64592 6.5272 1.45408 1.3318 41.655 2.14656 12.83...
result:
ok 18 tokens
Test #7:
score: 5
Accepted
time: 6ms
memory: 5028kb
input:
562036 800 494900 160000 710305 4096 549145 125000 277786 125 375881 390625 992034 2 702342 3125 569...
output:
702.545 3.093125 173.414306640625 4.39316 2222.288 0.96225536 496017 224.74944 7.1238125 47.119168 1...
result:
ok 18 tokens
Test #8:
score: 5
Accepted
time: 6ms
memory: 5032kb
input:
910 999 944 999 1978 999 581 999 482 999 380 999 130 999 838 999 326 999 1097 999 568 999 358 999 11...
output:
0.(910) 0.(944) 1.(979) 0.(581) 0.(482) 0.(380) 0.(130) 0.(838) 0.(326) 1.(098) 0.(568) 0.(358) 0.(0...
result:
ok 18 tokens
Test #9:
score: 5
Accepted
time: 5ms
memory: 5028kb
input:
8452 9999 4205 9999 4177 9999 73522 9999 2260 9999 9992 9999 45229 9999 6275 9999 1886 9999 63203 99...
output:
0.(8452) 0.(4205) 0.(4177) 7.(3529) 0.(2260) 0.(9992) 4.(5233) 0.(6275) 0.(1886) 6.(3209) 0.(6995) 0...
result:
ok 18 tokens
Test #10:
score: 5
Accepted
time: 9ms
memory: 5032kb
input:
652832 99999 86603 99999 698815 99999 733498 99999 81815 99999 208109 99999 37024 99999 4883 99999 7...
output:
6.(52838) 0.(86603) 6.(98821) 7.(33505) 0.(81815) 2.(08111) 0.(37024) 0.(04883) 7.(44120) 0.(87916) ...
result:
ok 18 tokens
Test #11:
score: 5
Accepted
time: 3ms
memory: 5032kb
input:
103 491 83 1 114 757 214 7 851 243 672 391 532 3 130 61 385 577 119 233 398 241 607 559 460 1 3 717 ...
output:
0.(2097759674134419551934826883910386965376782077393075356415478615071283095723014256619144602851323...
result:
ok 18 tokens
Test #12:
score: 5
Accepted
time: 4ms
memory: 5032kb
input:
4173 2067 5038 4221 9002 4023 5399 8061 3182 4767 6110 1191 2345 1919 2234 8581 2139 4047 5103 8841 ...
output:
2.(0188679245283) 1.(193556029376924899312959014451551764984600805496327884387585880123) 2.(23763360...
result:
ok 18 tokens
Test #13:
score: 5
Accepted
time: 69ms
memory: 5028kb
input:
122878 63889 743422 282861 708740 16059 224329 125883 600815 5271 229177 746563 135403 246477 916903...
output:
1.(9233044812095978963514846061137284978634819765530842555056425988824367261969979182644899748000438...
result:
ok 18 tokens
Test #14:
score: 5
Accepted
time: 5ms
memory: 5028kb
input:
792 834 521 262 307 500 269 340 155 96 414 536 173 96 137 735 187 321 577 788 787 958 811 192 563 28...
output:
0.(9496402877697841726618705035971223021582733812) 1.9(885496183206106870229007633587786259541984732...
result:
ok 18 tokens
Test #15:
score: 5
Accepted
time: 8ms
memory: 5032kb
input:
1985 1210 1986 723 1986 628 1988 52 1991 1026 1989 519 1989 1226 1989 21 1984 712 1996 27 1996 816 1...
output:
1.6(4049586776859504132231) 2.(746887966804979253112033195020) 3.1(624203821656050955414012738853503...
result:
ok 18 tokens
Test #16:
score: 5
Accepted
time: 6ms
memory: 5028kb
input:
9941 8960 4951 2688 5659 3776 6203 4096 3449 8816 1517 2269 8977 5183 4189 3777 4928 9496 37 9552 89...
output:
1.10948660(714285) 1.8418898(809523) 1.498675(847457627118644067796610169491525423728813559322033898...
result:
ok 18 tokens
Test #17:
score: 5
Accepted
time: 6ms
memory: 5028kb
input:
80258 62742 8017 18626 10499 36864 27011 55552 32593 37660 61539 72315 2281 51248 45697 64256 3866 3...
output:
1.(2791750342673169487743457333205827037709986930604698606993720314940550189665614739727774058844155...
result:
ok 18 tokens
Test #18:
score: 5
Accepted
time: 4ms
memory: 5032kb
input:
50937 87224 94005 68794 95287 97008 56806 11386 84920 37159 65243 1776 42961 26609 62779 4311 56039 ...
output:
0.583(9791800421902228744382280106392735944235531505090342107676786205631477574979363477941850866733...
result:
ok 18 tokens
Test #19:
score: 5
Accepted
time: 436ms
memory: 5032kb
input:
1000000 999983 999999 999983 999998 999983 999997 999983 999996 999983 999995 999983 999994 999983 9...
output:
1.(0000170002890049130835224198811379793456488760308925251729279397749761745949681144579457850783463...
result:
ok 18 tokens
Test #20:
score: 5
Accepted
time: 43ms
memory: 5028kb
input:
426133 364441 128599 195258 959887 821056 929791 105216 155657 164864 813863 352256 552086 307253 21...
output:
1.(1692784291558853147697432506221857584629610828638929209391918033371656866269162909771403327287544...
result:
ok 18 tokens
Extra Test:
score: 0
Extra Test Passed