提出 #20384771


ソースコード 拡げる

#include<bits/stdc++.h>
#define int long long
#define uc getchar()
#define ph putchar
#define R register
#define CN const
#define rint R int
#define cint CN int
#define ps ph(' ')
#define pe ph('\n')
using namespace std;
cint inf=998244353;
cint mix=1e6+5;
inline int in();
inline void out(rint x);
int n=in(),m=in(),k=in(),ans;
inline int ksm(rint x,rint y){
	rint rt=1;
	while(y){
		if(y&1)(rt*=x)%=inf;
		(x*=x)%=inf,y>>=1;
	}	return rt;
}
#undef int
int main() {
#define int long long
	if(m<n)swap(n,m);
	if(1<n){
		for(rint i=1;i<=k;++i)
		(ans+=(ksm(i,n)-ksm(i-1,n)+inf)*ksm(k+1-i,m))%=inf;
	} else ans=ksm(k,m);
	out(ans),pe;
}
inline int in() {
	rint x=0;
	R bool f=0;
	R char s=uc;
	while((s<'0'||'9'<s)&&s!='-')s=uc;
	if(s=='-')f=1,s=uc;
	while('0'<=s&&s<='9')(x*=10)+=s^48,s=uc;
	return f?-x:x;
}
inline void out(rint x) {
	if(x<0)ph('-'),x=-x;
	rint y=x/10;
	if(y)out(y);
	ph((x-y*10)^48);
}

提出情報

提出日時
問題 D - Sky Reflector
ユーザ juruo8601
言語 C++ (GCC 9.2.1)
得点 600
コード長 950 Byte
結果 AC
実行時間 40 ms
メモリ 3624 KiB

コンパイルエラー

./Main.cpp:15:22: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   15 | inline void out(rint x);
      |                      ^
./Main.cpp:17:21: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   17 | inline int ksm(rint x,rint y){
      |                     ^
./Main.cpp:17:28: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   17 | inline int ksm(rint x,rint y){
      |                            ^
./Main.cpp: In function ‘long long int ksm(long long int, long long int)’:
./Main.cpp:18:7: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   18 |  rint rt=1;
      |       ^~
./Main.cpp: In function ‘int main()’:
./Main.cpp:29:12: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   29 |   for(rint i=1;i<=k;++i)
      |            ^
./Main.cpp: In function ‘long long int in()’:
./Main.cpp:35:7: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   35 |  rint x=0;
      |       ^
./Main.cpp:36:9: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   36 |  R bool f=0;
      |         ^
./Main.cpp:37:9: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   37 |  R char s=uc;
      |         ^
./Main.cpp: At global scope:
./Main.cpp:43:22: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   43 | inline void out(rint x) {
      |                      ^
./Main.cpp: In function ‘void out(long long int)’:
./Main.cpp:45:7: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   45 |  rint y=x/10;
      |       ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 600 / 600
結果
AC × 3
AC × 15
セット名 テストケース
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, s1.txt, s2.txt, s3.txt
ケース名 結果 実行時間 メモリ
01.txt AC 40 ms 3444 KiB
02.txt AC 20 ms 3432 KiB
03.txt AC 2 ms 3592 KiB
04.txt AC 2 ms 3520 KiB
05.txt AC 2 ms 3444 KiB
06.txt AC 3 ms 3620 KiB
07.txt AC 2 ms 3596 KiB
08.txt AC 2 ms 3584 KiB
09.txt AC 7 ms 3452 KiB
10.txt AC 15 ms 3396 KiB
11.txt AC 6 ms 3392 KiB
12.txt AC 2 ms 3596 KiB
s1.txt AC 2 ms 3604 KiB
s2.txt AC 2 ms 3436 KiB
s3.txt AC 16 ms 3624 KiB