結果

問題 No.2545 Divide by 3
ユーザー Carpenters-Cat
提出日時 2023-11-24 22:50:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 1,999 ms
コンパイル使用メモリ 197,236 KB
最終ジャッジ日時 2025-02-18 00:26:29
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
	std::vector<tuple<int, int, int, int>> ans;
	ll iv = 1;
	iv <<= 32;
	iv /= 3;
	ans.emplace_back(0, 1, 1, 2);
	ans.emplace_back(0, 4, 4, 1);
	for (int n = 0; n < 32; n ++) {
		if ((iv >> n) & 1) {
			ans.emplace_back(0, 3, 3, 4);
		}
		ans.emplace_back(0, 4, 4, 4);
	}
	for (int n = 0; n < 32; n ++) {
		ans.emplace_back(1, 3, 3, 0);
	}
	cout << ans.size() << endl;
	for (auto [p, a, b, c] : ans) {
		if (p) {
			printf("div %d %d\n", a, b);
		} else {
			printf("plus %d %d %d\n", a, b, c);
		}
	}
	cout << flush;
}
0