結果

問題 No.1407 Kindness
コンテスト
ユーザー 👑 tails
提出日時 2021-03-02 20:56:13
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 370 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 117 ms
コンパイル使用メモリ 29,764 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-08 16:25:29
合計ジャッジ時間 1,074 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 36
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
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:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
  +++ |+#include <stdio.h>
    1 | #pragma GCC optimize("Ofast")
main.c:20:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
   20 |     printf("%d",((a%MD*INV2+b)%MD*c+d)%MD);
      |             ~^
      |              |
      |              int
      |             %ld

ソースコード

diff #
raw source code

#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