結果
問題 |
No.1624 三角形の反射
|
ユーザー |
![]() |
提出日時 | 2024-08-11 01:56:36 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 878 bytes |
コンパイル時間 | 1,047 ms |
コンパイル使用メモリ | 94,984 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-11 01:56:38 |
合計ジャッジ時間 | 2,062 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); string s; cin>>s; int now = 0; for(int i = 0;i<s.size();i++){ if(s[i]=='.') continue; now *= 10; now += s[i] - '0'; } for(int i = 1;1;i++){ int nxt = now * i; if(nxt%1000!=0) continue; int a = i; int b = nxt / 1000; //cout<<a<<" "<<b<<endl; int ans = a - 1 + b - 1 + max(a,b); int now = max(a,b); if((a+b)%2==1) ans--; char use; if(b%2==0){ if(a%2==0) use = 'A'; else use = 'B'; }else{ if(a%2==0) use = 'C'; else use = 'A'; } cout<<use<<" "<<ans<<endl; //cout<<ans<<endl; return 0; } }