結果

問題 No.3260 岩井スターグラフ
ユーザー Cafe1942
提出日時 2025-09-06 13:07:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 894 bytes
コンパイル時間 918 ms
コンパイル使用メモリ 110,188 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-06 13:08:03
合計ジャッジ時間 7,222 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 36
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:29:43: warning: ‘Y’ may be used uninitialized [-Wmaybe-uninitialized]
   29 |                         cout << (V - 1LL) % Y + 1LL << endl;
      |                                 ~~~~~~~~~~^~~
main.cpp:23:15: note: ‘Y’ was declared here
   23 |         ll X, Y, N;
      |               ^

ソースコード

diff #

#include <iostream>
#include <iomanip>//小数点出力用
//cout << fixed << setprecision(10) << ans;
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
using ll = long long;
using namespace std;
#define modPHash (ll)((1LL<<61)-1)
#define modP (ll)998244353
bool chkrng0idx(int pos, int sup) { return (0 <= pos && pos < sup); }
int clk4(int num) { return (num - 2) * (num % 2); }
void yn(bool tf) { cout << (tf ? "Yes\n" : "No\n"); }

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll X, Y, N;
	cin >> N;
	while (N--) {
		ll U, V;
		cin >> U >> V;
		if (U == 0) {
			cout << (V - 1LL) % Y + 1LL << endl;
		}
		else {
			if ((U - 1LL) / Y == (V - 1LL) / Y) {
				cout << V - U << endl;
			}
			else {
				cout << (U - 1LL) % Y + (V - 1LL) % Y + 2LL << endl;
			}
		}
	}
	return 0;
}

0