結果
問題 | No.2239 Friday |
ユーザー |
|
提出日時 | 2023-03-10 21:34:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 530 bytes |
コンパイル時間 | 4,308 ms |
コンパイル使用メモリ | 250,248 KB |
最終ジャッジ日時 | 2025-02-11 07:51:22 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include<bits/stdc++.h> using namespace std; #include<atcoder/all> using namespace atcoder; using ll = long long; int a,b; void solve(){ int ans = a+b; for(int i = 0;i<a+b;i++){ vector<int> isa(a+b); for(int j = 0;j<a;j++){ isa[(i+j)%(a+b)] = 1; } int w = 0,c = 0; for(int j = 0;j<(a+b);j++){ if((j<b&&isa[j])||(j>=b)&&isa[j]==0){ c++; }else{ w++; } } ans = min(ans,abs(w-c)); } cout<<ans<<endl; } signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); cin >> a >> b; solve(); }