結果

問題 No.825 賢いお買い物
ユーザー chacoder1chacoder1
提出日時 2021-05-24 20:46:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 747 bytes
コンパイル時間 2,179 ms
コンパイル使用メモリ 194,812 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 06:24:30
合計ジャッジ時間 2,820 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
#define int long long
static const int mod=1000000007;

signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  int temp=a/10;
  b+=temp;
  a-=temp*10;
  //cout<<a<<" "<<b<<endl;
  int minans=1000000007;
  for(int i=0;i<=a+10*b;i++){
    for(int j=0;j<=a;j++){
      for(int k=0;k<=b;k++){
        if(j+k*10==i && a-j+b-k==c){
          //cout<<"#"<<i<<endl;
          minans=min(minans,i);
        }
        if(j+k*10>=i && j+k*10-i+a-j+b-k==c){
          //cout<<j<<" "<<k<<"$"<<i<<endl;
          minans=min(minans,i);
        }
      }
    }
  }
  if(minans==0){
    cout<<"Impossible"<<endl;
    return 0;
  }
  cout<<minans<<endl;
  return 0;
}
0