結果

問題 No.851 テストケース
コンテスト
ユーザー π
提出日時 2019-07-26 22:41:34
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.89.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,232 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,879 ms
コンパイル使用メモリ 200,800 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-07 14:38:07
合計ジャッジ時間 4,180 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 2 WA * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:19: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘ll*’ {aka ‘long long int*’} [-Wformat=]
   26 |   sscanf(&s[0], "%d%d%d", p, p + 1, p + 2);
      |                  ~^       ~
      |                   |       |
      |                   int*    ll* {aka long long int*}
      |                  %lld
main.cpp:26:21: warning: format ‘%d’ expects argument of type ‘int*’, but argument 4 has type ‘ll*’ {aka ‘long long int*’} [-Wformat=]
   26 |   sscanf(&s[0], "%d%d%d", p, p + 1, p + 2);
      |                    ~^        ~~~~~
      |                     |          |
      |                     int*       ll* {aka long long int*}
      |                    %lld
main.cpp:26:23: warning: format ‘%d’ expects argument of type ‘int*’, but argument 5 has type ‘ll*’ {aka ‘long long int*’} [-Wformat=]
   26 |   sscanf(&s[0], "%d%d%d", p, p + 1, p + 2);
      |                      ~^             ~~~~~
      |                       |               |
      |                       int*            ll* {aka long long int*}
      |                      %lld
main.cpp:14:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |   scanf("%*s%*[\n]");
      |   ~~~~~^~~~~~~~~~~~~
main.cpp:16:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |     scanf("%c", &c);
      |     ~~~~~^~~~~~~~~~

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define MOD 1000000007
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;

int main() {
  char c;
  string s;
  ll p[3];
  scanf("%*s%*[\n]");
  for(int i = 0; i < 3;){
    scanf("%c", &c);
    if(c == ' ') {
      cout << "\"assert\"" << endl;
      return 0;
    }
    if(c == '\n') {
      i++;
    }
    s += c;
  }
  sscanf(&s[0], "%d%d%d", p, p + 1, p + 2);
  if(p[0] == p[1]) {
    cout << ((p[0] * 2 < p[0] + p[2]) ? p[0] * 2 : p[0] + p[2]) << endl;
    return 0;
  } else {
    ll a[3], q[3];
    a[0] = p[0] + p[1];
    a[1] = p[1] + p[2];
    a[2] = p[2] + p[0];
    q[0] = a[0] < a[1];
    q[1] = a[1] < a[2];
    q[2] = a[2] < a[0];
    if(a[0] == a[1]) {
      cout << ((a[0] < a[2]) ? a[0] : a[2]);
    } else if(a[1] == a[2]) {
      cout << ((a[1] < a[0]) ? a[1] : a[0]);
    } else if(a[2] == a[0]) {
      cout << ((a[2] < a[1]) ? a[2] : a[1]);
    } else if(q[0] == q[2]) {
      cout << a[0] << endl;
    } else if(q[0] == q[1]) {
      cout << a[1] << endl;
    } else if(q[1] == q[2]) {
      cout << a[2] << endl;
    }
  }
  return 0;
}
0