結果

問題 No.851 テストケース
ユーザー integer
提出日時 2019-08-21 22:41:18
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 2,185 ms
コンパイル使用メモリ 199,428 KB
最終ジャッジ日時 2025-01-07 14:35:55
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 18 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |     scanf("\n");
      |     ~~~~~^~~~~~

ソースコード

diff #

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


int check(string s){
    for (auto &&i : s){
        if (i==' ')return 0;
    }
    return 1;
}


int main() {
    int n;
    cin>>n;
    scanf("\n");
    string s;
    getline(cin,s);
    if(check(s)){
        vector<ll> ar(3);
        ll ans;
        ar[0]=stoll(s);
        rep(i,2) cin>>ar[i+1];
        sort(ar.begin(),ar.end());
        ans = ar[0]==ar[1] ? ar[0]*2 : ar[0]+ar[2];
        cout<<ans<<endl;
    }else{
        cout<<"assert"<<endl;
    }
    return 0;
}
0