結果

問題 No.3048 Swing
ユーザー lotoka
提出日時 2025-03-13 19:11:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 201 bytes
コンパイル時間 1,847 ms
コンパイル使用メモリ 192,344 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-13 19:11:28
合計ジャッジ時間 7,892 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 57 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int x, n;
	cin >> x >> n;
	
	for (int i = 0; i < n; i++) {
		if (x <= 0) {
			x += i;
		}
		else {
			x -= i;
		}
	}
	
	cout << x << endl;
}
0