結果

問題 No.314 ケンケンパ
ユーザー junsuijunsui
提出日時 2019-09-30 01:12:54
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 786 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 31,104 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 07:37:05
合計ジャッジ時間 1,213 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 0 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 WA -
testcase_04 AC 0 ms
6,944 KB
testcase_05 AC 0 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:34:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll’ {aka ‘long long int’} [-Wformat=]
   34 |         printf( "%d ", array[ i ] );
      |                  ~^    ~~~~~~~~~~
      |                   |             |
      |                   int           ll {aka long long int}
      |                  %lld
main.cpp:41:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll’ {aka ‘long long int’} [-Wformat=]
   41 |         printf( "%d\n", sum );
      |                  ~^     ~~~
      |                   |     |
      |                   int   ll {aka long long int}
      |                  %lld

ソースコード

diff #

#include <cstdio>
#include <cmath>
#define rep( i, n, m ) for(ll i = ( n ); i < ( m ); i++)
using ll = long long int;

int give_water( int* array, int begin, int end );

int main( void ){
	int n;
	if (!scanf( "%d", &n ))
		return 0;
	if (n < 7){
		if (n < 3)
			printf( "%d\n", n );
		else
			printf( "%d\n", n - 1 );
		return 0;
	}
	int times = ( n - 6 ) / 2;
	ll array[] = {1, 2, 2};
	rep( i, 0, times ){
		int a = 0, b = 0, c = 0;
		a = array[ 1 ];
		b = array[ 1 ] + array[ 2 ];
		c = array[ 0 ] + array[ 2 ];
		array[ 0 ] = a;
		array[ 1 ] = b;
		array[ 2 ] = c;
	}
	if (n % 2 != 0){
		array[ 2 ] *= 2;
	}
	rep( i, 0, 3 )
	printf( "%d ", array[ i ] );
	printf( "\n" );
	ll sum = 0;
	rep( i, 0, 3 ){
		sum += array[ i ];
		sum %= 1000000007;
	}
	printf( "%d\n", sum );
	return 0;
}
0