結果

問題 No.740 幻の木
ユーザー toto
提出日時 2025-04-01 10:52:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 387 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 27,648 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-01 10:52:28
合計ジャッジ時間 1,212 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 3 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%lld%lld",&leaf,&fall);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d%d",&start,&between);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	long long leaf, fall;
	scanf("%lld%lld",&leaf,&fall);
	
	int start,between;
	scanf("%d%d",&start,&between);
	
	int month = 1;
	int ans = 0;
	while(0 < leaf){
		if(ans % 12 < start){
			leaf -= fall;
		}else if(ans % 12 >= start && ans % fall <= start + between % 12){
			leaf -= (fall *  2);
		}
		ans++;
		month++;
		month %= 12;
	}
	printf("%d",ans);
}
0