結果

問題 No.538 N.G.S.
ユーザー dnishdnish
提出日時 2017-06-30 23:04:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 655 bytes
コンパイル時間 1,930 ms
コンパイル使用メモリ 162,740 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 06:56:48
合計ジャッジ時間 6,219 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 2 ms
6,944 KB
testcase_13 RE -
testcase_14 AC 2 ms
6,944 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 1 ms
6,944 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 2 ms
6,944 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 AC 2 ms
6,944 KB
testcase_35 AC 2 ms
6,940 KB
testcase_36 AC 2 ms
6,940 KB
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 2 ms
6,944 KB
testcase_39 AC 2 ms
6,940 KB
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 AC 2 ms
6,940 KB
testcase_45 AC 2 ms
6,944 KB
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 AC 2 ms
6,940 KB
testcase_53 RE -
testcase_54 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int) N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=(int) n;i--)
#define p(s) cout<<(s)<<endl
#define DEBUG(x,y) cout<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl;
#define CK(n,a,b) ((a)<=(n)&&(n)<=(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const ll inf=1e5;

int b1,b2,b3;
int r;
bool flag;
int main(){
	cin>>b1>>b2>>b3;

	REP(i,-1e4,1e4+1){
		if(b3-b2 == i*(b2-b1)){
			r=i;
			flag=true;
			break;

		}
	}
	if(!flag){
		REP(i,-1e4,1e4+1){
			if(i*(b3-b2) == (b2-b1)){
				r=i;
				break;
			}

		}
		p((b3-b1)/r+b2);
	}else{
		p(r*(b3-b1)+b2);
	}

	return 0;
}

0