結果
| 問題 | No.825 賢いお買い物 | 
| コンテスト | |
| ユーザー |  tnakao0123 | 
| 提出日時 | 2019-05-09 11:17:10 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 915 bytes | 
| コンパイル時間 | 610 ms | 
| コンパイル使用メモリ | 84,556 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-02 00:47:01 | 
| 合計ジャッジ時間 | 1,414 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:39:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   39 |   scanf("%d%d%d", &a, &b, &c);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
/* -*- coding: utf-8 -*-
 *
 * 825.cc:  No.825 賢いお買い物 - yukicoder
 */
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;
/* constant */
/* typedef */
/* global variables */
/* subroutines */
/* main */
int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  int maxp = a + 10 * b;
  for (int p = 1; p <= maxp; p++)
    for (int u = 0; u <= a; u++)
      for (int t = 0; t <= b; t++) {
	int q = u + 10 * t;
	if (q >= p) {
	  int g = q - p;
	  int a0 = a - u + g % 10;
	  int b0 = b - t + g / 10;
	  if (a0 + b0 == c) {
	    printf("%d\n", p);
	    return 0;
	  }
	}
      }
  puts("Impossible");
  return 0;
}
            
            
            
        