結果

問題 No.186 中華風 (Easy)
コンテスト
ユーザー kk0414
提出日時 2026-10-24 17:19:27
言語 C++17(clang)
(clang++ 23.1.3 + boost 1.92.0 + ACL)
コンパイル:
clang++ -O2 -lm -std=c++1z -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 2,723 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,524 ms
コンパイル使用メモリ 159,788 KB
実行使用メモリ 9,908 KB
最終ジャッジ日時 2026-10-24 17:23:03
合計ジャッジ時間 2,964 ms
ジャッジサーバーID
(参考情報)
judge6_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<cmath>
#include<unordered_set>
#include<unordered_map>
#include<iomanip>
#include<functional>
#include<numeric>
#include<regex>

using namespace std;
// 型名の短縮
using ll = long long; 
using pii = pair<int, int>;	
using pll = pair<ll,ll>;
using vi = vector<int>;		using vvi = vector<vi>; using vvvi = vector<vvi>;
using vl = vector<ll>;		using vvl = vector<vl>; using vvvl = vector<vvl>;
using vc = vector<char>;		using vvc = vector<vc>; using vvvc = vector<vvc>;

template <class T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
template <typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template <typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }

#define all(a) a.begin(),a.end()
#define rep(i, n) for(int i = 0, i##_end = int(n); i < i##_end; ++i) // 0 から n-1 まで昇順
#define repi(i, s, t) for(int i = int(s), i##_end = int(t); i <= i##_end; ++i) // s から t まで昇順
#define repir(i, s, t) for(int i = int(s), i##_end = int(t); i >= i##_end; --i) // s から t まで降順
#define repe(v, a) for(const auto& v : (a)) // a の全要素(変更不可能)
#define repea(v, a) for(auto& v : (a)) // a の全要素(変更可能)
#define repb(set, d) for(int set = 0; set < (1 << int(d)); ++set) // d ビット全探索(昇順)
#define repp(a) sort(all(a)); for(bool a##_perm = true; a##_perm; a##_perm = next_permutation(all(a))) // a の順列全て(昇順)
#define smod(n, m) ((((n) % (m)) + (m)) % (m)) // 非負mod
#define uniq(a) {sort(all(a)); (a).erase(unique(all(a)), (a).end());} // 重複除去
// template <class T> inline T smod(T n, T m) { n %= m; if (n < 0) n += m; return n; } // 非負mod
long long TEN(int x) { return x == 0 ? 1 : TEN(x - 1) * 10; };

//ll mod = 998244353;
//ll mod = 1000000007;

//#include "dsu.hpp"
//#include "scc.hpp"
//#include "fenwicktree.hpp"
//#include "segtree.hpp"
//#include "modint.hpp"
//#include "lazysegtree.hpp"
//#include<atcoder/all>
//using namespace atcoder;
//using mint = modint998244353;


long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x);
    y -= a/b * x;
    return d;
}



int main(){
    vl X(3);
    vl Y(3);
    rep(i,3) cin>>X[i]>>Y[i];
    
    ll k1,k2;
    k1=k2=1;
    rep(i,2){
    	ll c = X[i+1]-X[i];
    	ll a = k1*Y[i];
    	ll b = Y[i+1];
    	extGCD(a,-b,k1,k2);
    	swap(k1,k2);
    }
    
    cout << k1*Y[2]+X[2] << endl;
}
0