結果

問題 No.1620 Substring Sum
ユーザー nok0nok0
提出日時 2021-05-29 12:58:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 444 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 27,520 KB
最終ジャッジ日時 2025-01-21 20:29:16
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 4 WA * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%s", s);
      |         ~~~~~^~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>

const int mod = 1000000007;
int rui2[200010], rui11[200010], n;
char s[200010];
long long res;
int main() {
	rui2[0] = rui11[0] = 1;
	for(int i = 0; i < 200000; i++)
		rui2[i + 1] = rui2[i] * 2ll % mod, rui11[i + 1] = rui11[i] * 11ll % mod;
	scanf("%s", s);
	n = strlen(s);
	for(int i = 0; i < n; i++) {
		res += rui2[i] * rui11[n - 1 - i] * (s[i] - '0') % mod;
		res %= mod;
	}
	printf("%lld\n", res);
}
0