Submission #41041722
Source Code Expand
//This code is written by hmz,and hmz is cute!!!
#include<bits/stdc++.h>
using namespace std;
#define TY long long
#define umap unordered_map
#define ull unsigned long long
#define pq priority_queue
#define mp make_pair
#define mod (TY)(998244353)
#define MAXN 200005
#define MAXM 200005
#define MAXK 27
#define INF (TY)1e9
#define Birthday 20090321
#define Read(name) freopen(#name,"r",stdin);
#define Write(name) freopen(#name,"w",stdout);
#define For(i,a,b) for(TY i=(a);i<=(b);++i)
#define FOR(i,a,b) for(TY i=(a);i<(b);++i)
#define Rof(i,a,b) for(TY i=(a);i>=(b);--i)
#define ROF(i,a,b) for(TY i=(a);i>(b);--i)
inline TY qr(){
TY x=0,f=1;char op=getchar();
for(;op<'0'||op>'9';op=getchar())if(op=='-')f=-1;
for(;op>='0'&&op<='9';op=getchar())x=x*10+(op^48);
return x*f;
}inline bool ischar(char op){
if(op>='a'&&op<='z')return true;
if(op>='A'&&op<='Z')return true;
return false;
}inline char getc(){
char op=getchar();
while(!ischar(op))op=getchar();
return op;
}inline string qs(){
string op="";char u=getchar();
while(!ischar(u))u=getchar();
while(ischar(u))op+=u,u=getchar();
return op;
}inline void qw(TY x){
if(!x){putchar('0');return;}
if(x<0)putchar('-'),x=-x;
if(x>=10)qw(x/10);putchar(x%10+'0');
}inline void qw(TY x,char op){qw(x),putchar(op);}
inline void ws(string s){FOR(i,0,s.size())putchar(s[i]);}
inline TY Ceil(TY a,TY b){return a/b+(a%b!=0);}
inline TY Mod(TY a){return (a>=mod?a-mod:a);}
inline TY Abs(TY a,TY b){return a>b?a-b:b-a;}
inline TY Pow(TY a,TY b){
TY ans=1,base=a;
while(b){
if(b&1)ans=ans*base%mod;
base=base*base%mod;b>>=1;
}return ans;
}TY n,dp[101][101][101];
int main(){
n=qr();TY a=0,b=0,c=0,s=Pow(6,mod-2);
while(n%2==0)++a,n/=2;
while(n%3==0)++b,n/=3;
while(n%5==0)++c,n/=5;
if(n!=1){qw(0);return 0;}
dp[0][0][0]=1;For(i,0,a)For(j,0,b)For(k,0,c){
if(i==0&&j==0&&k==0)continue;
if(i)dp[i][j][k]=Mod(dp[i][j][k]+dp[i-1][j][k]*s%mod);
if(j)dp[i][j][k]=Mod(dp[i][j][k]+dp[i][j-1][k]*s%mod);
if(i>=2)dp[i][j][k]=Mod(dp[i][j][k]+dp[i-2][j][k]*s%mod);
if(k)dp[i][j][k]=Mod(dp[i][j][k]+dp[i][j][k-1]*s%mod);
if(i&&j)dp[i][j][k]=Mod(dp[i][j][k]+dp[i-1][j-1][k]*s%mod);
dp[i][j][k]=dp[i][j][k]*(6*Pow(5,mod-2)%mod)%mod;
}qw(dp[a][b][c]);
return 0;
}
Submission Info
Submission Time
2023-04-29 21:55:26+0900
Task
E - Dice Product 3
User
hmzqwq
Language
C++ (GCC 9.2.1)
Score
500
Code Size
2303 Byte
Status
AC
Exec Time
7 ms
Memory
4100 KiB
Compile Error
./Main.cpp: In function ‘void qw(long long int)’:
./Main.cpp:42:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
42 | if(x>=10)qw(x/10);putchar(x%10+'0');
| ^~
./Main.cpp:42:20: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
42 | if(x>=10)qw(x/10);putchar(x%10+'0');
| ^~~~~~~
./Main.cpp: In function ‘void ws(std::string)’:
./Main.cpp:18:34: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
18 | #define FOR(i,a,b) for(TY i=(a);i<(b);++i)
| ^
./Main.cpp:44:26: note: in expansion of macro ‘FOR’
44 | inline void ws(string s){FOR(i,0,s.size())putchar(s[i]);}
| ^~~
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
500 / 500
Status
Set Name
Test Cases
Sample
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 01_small_06.txt, 01_small_07.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 03_limited_00.txt, 03_limited_01.txt, 03_limited_02.txt, 03_limited_03.txt, 03_limited_04.txt, 03_limited_05.txt
Case Name
Status
Exec Time
Memory
00_sample_00.txt
AC
7 ms
3576 KiB
00_sample_01.txt
AC
2 ms
3440 KiB
00_sample_02.txt
AC
2 ms
3600 KiB
00_sample_03.txt
AC
3 ms
3764 KiB
01_small_00.txt
AC
2 ms
3528 KiB
01_small_01.txt
AC
1 ms
3624 KiB
01_small_02.txt
AC
2 ms
3556 KiB
01_small_03.txt
AC
2 ms
3428 KiB
01_small_04.txt
AC
2 ms
3440 KiB
01_small_05.txt
AC
2 ms
3388 KiB
01_small_06.txt
AC
2 ms
3516 KiB
01_small_07.txt
AC
2 ms
3568 KiB
02_random_00.txt
AC
2 ms
3416 KiB
02_random_01.txt
AC
2 ms
3532 KiB
02_random_02.txt
AC
4 ms
3880 KiB
02_random_03.txt
AC
2 ms
3820 KiB
02_random_04.txt
AC
2 ms
3708 KiB
02_random_05.txt
AC
7 ms
3812 KiB
02_random_06.txt
AC
2 ms
3512 KiB
03_limited_00.txt
AC
2 ms
3876 KiB
03_limited_01.txt
AC
3 ms
3468 KiB
03_limited_02.txt
AC
3 ms
4100 KiB
03_limited_03.txt
AC
2 ms
3388 KiB
03_limited_04.txt
AC
2 ms
3488 KiB
03_limited_05.txt
AC
2 ms
3456 KiB