結果

問題 No.1407 Kindness
ユーザー tails
提出日時 2021-03-02 20:56:13
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 370 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 28,928 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-03 02:08:25
合計ジャッジ時間 1,605 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:10:1: warning: return type defaults to 'int' [-Wimplicit-int]
   10 | main(){
      | ^~~~
main.c: In function 'main':
main.c:20:5: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   20 |     printf("%d",((a%MD*INV2+b)%MD*c+d)%MD);
      |     ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | #pragma GCC optimize("Ofast")
main.c:20:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   20 |     printf("%d",((a%MD*INV2+b)%MD*c+d)%MD);
      |     ^~~~~~
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

char*mmap();

#define MD 1000000007
#define INV2  ((MD+1)/2)
#define INV45 822222228

main(){
	char*p=mmap(0l,1l<<28,1,2,0,0ll);
    long a=0,b=45,c=INV45,d=MD-1;
	int x;
	while(x=*p++-48,x>=0){
        b=b*INV45*x%MD;
        a+=b*(x-1);
		c=c*45%MD;
		d+=c;
    }
    printf("%d",((a%MD*INV2+b)%MD*c+d)%MD);
}
0