結果

問題 No.1756 Rider's Triangle
ユーザー monnumonnu
提出日時 2021-11-20 17:00:02
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 713 bytes
コンパイル時間 5,905 ms
コンパイル使用メモリ 225,500 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-02 12:25:44
合計ジャッジ時間 5,209 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define INF 1000000000000000000
#define MOD 998244353
#define MAX 1000000

ll gcd(ll a,ll b){
  while(a%b!=0){
    ll tmp=a%b;
    a=b;
    b=tmp;
  }
  return b;
}

int main(){
  ll a,b,N;
  cin>>a>>b>>N;
  if(a==b||a==0||b==0){
    cout<<0<<'\n';
    return 0;
  }
  ll x1=a;
  ll y1=b;
  ll x2,y2;
  //(b*i-a*j)/(a*i+b*j)=a/b
  //b*(b*i-a*j)=a*(a*i+b*j)
  //(b*b-a*a)*i=2*a*b*j
  ll i=2*a*b;
  ll j=b*b-a*a;
  ll g=gcd(i,j);
  i/=g;
  j/=g;
  ll X=a*i+b*j;
  ll Y=b*i;
  ll ans=(max<ll>(0,N-X)%MOD)*(max<ll>(0,N-Y)%MOD)%MOD;
  ans=8*ans%MOD;
  cout<<ans<<'\n';
}
0