結果
| 問題 | No.740 幻の木 |
| コンテスト | |
| ユーザー |
chacoder1
|
| 提出日時 | 2020-12-29 09:44:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 557 bytes |
| 記録 | |
| コンパイル時間 | 1,676 ms |
| コンパイル使用メモリ | 191,536 KB |
| 最終ジャッジ日時 | 2025-01-17 07:58:01 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,M,P,Q;
cin>>N>>M>>P>>Q;
//YD 1年に落とす葉の数
int YD=0;
YD=M*12+Q*M;
//cnt 経過月数
int cnt=0;
cnt+=(N/YD)*12;
//DD 年単位で葉を落とした後の余った葉の数
int DD=0;
DD=N-YD*(N/YD);
//剰余月数
int MM=0;
while(DD>0){
cnt++;
MM++;
//cout<<cnt<<" "<<DD<<endl;
if(MM>=P && MM<=P+Q-1){
DD-=(2*M);
}
else{
DD-=M;
}
if(MM==12){
MM=0;
}
}
cout<<cnt<<endl;
return 0;
}
chacoder1