結果

問題 No.793 うし数列 2
コンテスト
ユーザー ok
提出日時 2019-02-23 10:02:42
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 23,424 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-28 19:34:12
合計ジャッジ時間 1,289 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
   20 |         printf("%d",(3*(P+MOD-1)*IE9+P)%MOD);
      |                 ~^
      |                  |
      |                  int
      |                 %lld
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%lld",&N);
      |         ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#define int long long
#define MOD ((int)1e9+7)

#define IE9  111111112ll

signed main(){
	int N, P = 1, x = 10;
	
	scanf("%lld",&N);
	
	while(N){
		if(N&1) P *= x;
		x *= x;
		P %= MOD;
		x %= MOD;
		N>>=1;
	}
	
	printf("%d",(3*(P+MOD-1)*IE9+P)%MOD);
	
	return 0;
}
0