結果

問題 No.538 N.G.S.
ユーザー Dameningen
提出日時 2017-06-30 23:21:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,327 bytes
コンパイル時間 764 ms
コンパイル使用メモリ 79,376 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-04 21:25:25
合計ジャッジ時間 1,734 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<cassert>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

void swap(int& a, int& b);

int main()
{
    int b1, b2, b3;
    cin >> b1 >> b2 >> b3;
    if ( (b2*b3 - b3*b3 - b1*b2 + b1*b3) % (b1 - b2) != 0 )
        ::swap(b1, b2);
    else if ( (b2*b3 - b3*b3 - b1*b2 + b1*b3) % (b1 - b2) != 0 )
        ::swap(b2, b3);
    else if ( (b2*b3 - b3*b3 - b1*b2 + b1*b3) % (b1 - b2) != 0 )
        ::swap(b1, b2);
    else if ( (b2*b3 - b3*b3 - b1*b2 + b1*b3) % (b1 - b2) != 0 )
        ::swap(b2, b3);
    else if ( (b2*b3 - b3*b3 - b1*b2 + b1*b3) % (b1 - b2) != 0 )
        ::swap(b1, b2);
    
    cout << (b2*b3 - b3*b3 - b1*b2 + b1*b3) / (b1 - b2) + b2 << endl;
    return 0;
}

void swap(int& a, int& b)
{
    int temp = a;
    a = b;
    b = temp;
}
0