結果

問題 No.333 門松列を数え上げ
ユーザー kimagureman
提出日時 2016-02-06 15:53:23
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 460 ms
コンパイル使用メモリ 53,856 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-21 20:49:53
合計ジャッジ時間 897 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main(int argc, char** argv)
{
	const unsigned int max = 2000000000;
	unsigned int a, b, c=0;
	cin >> a >> b;

	if (a < b) {
		c = (b-a + a-1);
		c += (a!=1) * -1;
		c += (b==max) * -1;
		cout << c << endl;
	}
	else {
		cout << (max-b-1) << endl;
	}

	return 0;
}
0