結果
| 問題 |
No.333 門松列を数え上げ
|
| コンテスト | |
| ユーザー |
kichirb3
|
| 提出日時 | 2018-03-04 11:26:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 497 bytes |
| コンパイル時間 | 412 ms |
| コンパイル使用メモリ | 64,564 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-07 03:14:15 |
| 合計ジャッジ時間 | 832 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 |
コンパイルメッセージ
main.cpp: In function 'int solve(int, int)':
main.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
29 | }
| ^
ソースコード
// No.333 門松列を数え上げ
// https://yukicoder.me/problems/no/333
//
#include <iostream>
using namespace std;
int solve(int A, int B);
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int A, B;
cin >> A >> B;
int ans = solve(A, B);
cout << ans << endl;
}
int solve(int A, int B) {
if (A == B)
return 0;
if (A < B)
return (A - 1) + (B - A - 1);
if (A > B)
return (2000000000 - A) + (A - B - 1);
}
kichirb3