結果

問題 No.1003 サイコロの実装 (1)
ユーザー UMRgurashiUMRgurashi
提出日時 2021-01-03 18:38:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 11,691 bytes
コンパイル時間 1,113 ms
コンパイル使用メモリ 101,732 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 12:24:47
合計ジャッジ時間 2,094 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,248 KB
testcase_03 AC 2 ms
5,248 KB
testcase_04 AC 2 ms
5,248 KB
testcase_05 AC 1 ms
5,248 KB
testcase_06 AC 1 ms
5,248 KB
testcase_07 AC 2 ms
5,248 KB
testcase_08 AC 1 ms
5,248 KB
testcase_09 AC 1 ms
5,248 KB
testcase_10 AC 1 ms
5,248 KB
testcase_11 AC 2 ms
5,248 KB
testcase_12 AC 2 ms
5,248 KB
testcase_13 AC 2 ms
5,248 KB
testcase_14 AC 2 ms
5,248 KB
testcase_15 AC 1 ms
5,248 KB
testcase_16 AC 2 ms
5,248 KB
testcase_17 AC 2 ms
5,248 KB
testcase_18 AC 2 ms
5,248 KB
testcase_19 AC 1 ms
5,248 KB
testcase_20 AC 2 ms
5,248 KB
testcase_21 AC 1 ms
5,248 KB
testcase_22 AC 2 ms
5,248 KB
testcase_23 AC 2 ms
5,248 KB
testcase_24 AC 2 ms
5,248 KB
testcase_25 AC 2 ms
5,248 KB
testcase_26 AC 1 ms
5,248 KB
testcase_27 AC 1 ms
5,248 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'char z(char, char)':
main.cpp:445:1: warning: control reaches end of non-void function [-Wreturn-type]
  445 | }
      | ^

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<map>
#include<cstdio>
#include<iomanip>
#include<set>
#include<numeric>
#include<queue>
#include<deque>
#include<utility>
#include<stack>
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
#pragma region Macros
using namespace std;
#define int long long
#define double long double


constexpr double PI = 3.14159265358979323846;
const  int INF = 1e12;
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
const int days[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define krep(i,k,n) for(int i=(k);i<n+k;i++)
#define Krep(i,k,n) for(int i=(k);i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define Rrep(i,n) for(int i=n;i>0;i--)

#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x)
#define RUD(a,b) ((a+b-1)/b)
#define sum1_n(n) ((n)*(n+1)/2)
#define SUM1n2(n) (n*(2*n+1)*(n+1))/6
#define SUMkn(k,n) (SUM1n(n)-SUM1n(k-1))
#define PB push_back
#define Fi first
#define Se second 

int intpow(int a, int n) {
	// a^nのint ver
	int ans = a;
	if (n == 0)
		return 1;
	else {
		rep(i, n - 1)
			ans *= a;
		return ans;
	}
}
int factorial(int a) {
	if (a == 0)
		return 1;
	else
		return a * factorial(a - 1);
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
int GCD(int a, int b)
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b)
{
	return  a * b / GCD(a, b);
}
int divisor_count(int n) {
	//約数の数
	int ans = 0;
	REP(i, sqrt(n)) {
		if (n % i == 0)
			ans += 2;
		if (n == i * i)
			ans--;
	}
	return ans;
}
int divisor_sum(int n) {
	//約数の総和
	int ans = 0;
	REP(i, sqrt(n)) {
		if (n % i == 0)
			ans += i + n / i;
		if (n == i * i)
			ans -= n / i;
	}
	return ans;
}
int CEIL1(int n) {
	//1桁目切り上げ
	return (n + 9) / 10 * 10;
}
int getdigit(int n) {
	return log10(n) + 1;
}
/*
int digit(int n, int k) {
	//nのk桁目
	rep(i, k - 1)
		n /= 10;
	return n % 10;
}
*/
int digit_sum(int n) {
	int sum = 0, dig;
	while (n) {
		dig = n % 10;
		sum += dig;
		n /= 10;
	}
	return sum;
}
int DIVTIME(int n, int k) {
	//nをkで何回割れるか的な
	int div = 0;
	while (n % k == 0) {
		div++;
		n /= k;
	}
	return div;
}
#pragma region base
/*
int n_decimal(int k, int n) {
	int ans = 0;
	for (int i = 0; k > 0; i++) {
		ans += k % n * intpow(10, i);
		k /= n;
	}
	return ans;
}
*/
int binary_2to10(string n) {
	int ans = 0;
	rep(i, n.size()) {
		if (n[i] == '1')
			ans += intpow(2, n.size() - i - 1);
	}
	return ans;
}
string base_k(int n,int k) {
	//n(10)をk進数(string)で
	string ans = "";
	while (n) {
		ans += to_string(n % k);
		n /= k;
	}
	reverse(ALL(ans));
	return ans;
}
#pragma endregion
int intabs(int n) {
	if (n < 0)
		return -1 * n;
	else
		return n;
}
/*
int Kaibun(int n) {
	int ans = 0;
	int d = getdigit(n);
	REP(i, d)
		ans += digit(n, i) * pow(10, d - i);
	return ans;
}
*/


inline bool is_uru(int y) {
	if (y % 400 == 0)
		return 1;
	if (y % 100 == 0)
		return 0;
	if (y % 4 == 0)
		return 1;
	return 0;
}
void next_date(int& y, int& m, int& d) {
	int day = days[m];
	if (m == 2 && is_uru(y))
		day++;
	d++;
	if (day < d) {
		m++;
		d = 1;
	}
	if (m == 13) {
		y++;
		m = 1;
	}
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
double DISTANCE(int x1, int y1, int x2, int y2) {
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
double clock_angle(int h, int m) {
	h %= 12;
	double mm = 6.0 * m;
	double nn = 30.0 * h + 0.5 * m;
	return std::min(fabs(mm - nn), 360.0 - fabs(nn - mm));
}
double heron(double a, double b, double c) {
	double s = (a + b + c) / 2.0;
	return sqrt(s * (s - a) * (s - b) * (s - c));
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool between(int x, int min, int max) {
	if (min < x && x < max)
		return true;
	else
		return false;
}
inline bool is_prime(int x) {
	if (x == 1)
		return false;
	if (x == 2)
		return true;
	if (x % 2 == 0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}
inline bool is_sqrt(int n) {
	if (sqrt(n) == (int)sqrt(n))
		return true;
	else
		return false;
}
template<class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#pragma endregion

typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<vvint> vvvint;
typedef vector<string> vstring;
typedef vector<bool> vbool;
typedef vector<vbool> vvbool;
typedef map<int, int> mapint;
typedef pair<int, int> pint;
typedef vector<pint> vpint;
using Graph = vector<vint>;

#pragma region MOD
template<int MOD> struct Fp {
	long long val;
	constexpr Fp(long long v = 0) noexcept : val(v% MOD) {
		if (val < 0) val += MOD;
	}
	constexpr int getmod() const { return MOD; }
	constexpr Fp operator - () const noexcept {
		return val ? MOD - val : 0;
	}
	constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
	constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
	constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
	constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
	constexpr Fp& operator += (const Fp& r) noexcept {
		val += r.val;
		if (val >= MOD) val -= MOD;
		return *this;
	}
	constexpr Fp& operator -= (const Fp& r) noexcept {
		val -= r.val;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr Fp& operator *= (const Fp& r) noexcept {
		val = val * r.val % MOD;
		return *this;
	}
	constexpr Fp& operator /= (const Fp& r) noexcept {
		long long a = r.val, b = MOD, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b, swap(a, b);
			u -= t * v, swap(u, v);
		}
		val = val * u % MOD;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr bool operator == (const Fp& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Fp& r) const noexcept {
		return this->val != r.val;
	}
	friend constexpr istream& operator >> (istream& is, Fp<MOD>& x) noexcept {
		is >> x.val;
		x.val %= MOD;
		if (x.val < 0) x.val += MOD;
		return is;
	}
	friend constexpr ostream& operator << (ostream& os, const Fp<MOD>& x) noexcept {
		return os << x.val;
	}
	friend constexpr Fp<MOD> modpow(const Fp<MOD>& r, long long n) noexcept {
		if (n == 0) return 1;
		if (n < 0) return modpow(modinv(r), -n);
		auto t = modpow(r, n / 2);
		t = t * t;
		if (n & 1) t = t * r;
		return t;
	}
	friend constexpr Fp<MOD> modinv(const Fp<MOD>& r) noexcept {
		long long a = r.val, b = MOD, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b, swap(a, b);
			u -= t * v, swap(u, v);
		}
		return Fp<MOD>(u);
	}
};
using mint = Fp<MOD>;
#pragma endregion

#pragma region nCr
const int MAXR = 10000000;
int fac[MAXR], finv[MAXR], inv[MAXR];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXR; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

int nCr(int n, int k) {
	if (n < k)
		return 0;
	if (n < 0 || k < 0)
		return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

mint nCrm(long long N, long long K) {
	mint res = 1;
	for (long long n = 0; n < K; ++n) {
		res *= (N - n);
		res /= (n + 1);
	}
	return res;
}
int nCr2(int n, int r) {
	//MODらない奴
	int ans = 1;
	REP(i, r) {
		ans *= n--;
		ans /= i;
	}
	return ans;
}
#pragma endregion

vector<pint> prime_factorize(int N) {
	vector<pint>  res;
	for(int i=2;i*i<=N;i++){
		if (N % i != 0)
			continue;
		int ex = 0;
		while (N % i == 0) {
			++ex;
			N /= i;
		}
		res.push_back({ i, ex });
	}
	if (N != 1)
		res.push_back({ N, 1 });
	return res;
}
double median(vint a) {
	int N = a.size();
	if (N % 2 == 1)
		return (double)a[N / 2];
	else
		return (double)(a[N / 2 - 1] + a[N / 2]) / 2;
}


char z(char a, char b) {
	if (a > b)
		swap(a, b);
	if (a == b)
		return a;
	if (a == 'R' && b == 'S')
		return  'R';
	if (a == 'P' && b == 'R')
		return  'P';
	if (a == 'P' && b == 'S')
		return  'S';
}



int sum_xor(int x) {
	if (x % 4 == 1)
		return 1;
	if (x % 4 == 3)
		return 0;
	return (x + 1) ^ sum_xor(x + 1);
}

struct UnionFind {
	//自身が親であれば、その集合に属する頂点数に-1を掛けたもの
	//そうでなければ親のid
	vint r;
	UnionFind(int N) {
		r = vint(N, -1);
	}
	int root(int x) {
		if (r[x] < 0)
			return x;
		return r[x] = root(r[x]);
	}

	bool is_same(int x, int y) {
		return root(x) == root(y);
	}

	bool unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y)
			return false;
		if (r[x] > r[y])
			swap(x, y);
		r[x] += r[y];
		r[y] = x;
		return true;
	}

	int size(int x) {
		return -r[root(x)];
	}
};


#pragma region Segment Tree
#define len (1<<22)
int seg[len * 2];

void add(int ind, int v) {
	ind += len;
	seg[ind] += v;
	while (ind/2!=0) {
		ind /= 2;
		seg[ind] = seg[ind * 2]+seg[ind * 2 + 1];
	}
}

int sum(int l, int r) {
	l += len, r += len;
	int ans = 0;
	while (l<r) {
		if (l % 2) {
			ans += seg[l];
			l++;
		}
		l /= 2;
		if (r % 2) {
			ans += seg[r - 1];
			r--;
		}
		r /= 2;
	}
	return ans;
}
#pragma endregion

signed main() {
	int N;
	cin >> N;
	string ans = "No";
	if (N % 6==0)
		ans = "Yes";
	cout << ans << endl;
}


//2分探索テンプレ
/*
bool solve() {
}

int l=
int r=
int mid;
while(abs(l-r)>1){
	mid = l + (r-l)/2;
	if(solve(mid))
		l = mid;
	else
		r = mid;
}
*/

//bit全探索テンプレ
/*
rep(bit,1<<N){
	vint S;
	rep(i,N){
		if (bit & (1 << i))
			S.push_back(i);
	}
}
*/

//グラフ受け取り
/*
int N, M;
cin >> N >> M;

Graph G(N + 1);
rep(i, M) {
	int a, b;
	cin >> a >> b;
	G[a].push_back(b);
	G[b].push_back(a);
}
*/

//グラフ型BFSテンプレ
/*
	vector<int> dist(N+1, -1);
	queue<int> que;

	dist[1] = 0;
	que.push(1);

	while (!que.empty()) {
		int v = que.front();
		que.pop();

		for (int nv : G[v]) {
			if (dist[nv] != -1)
				continue;

			dist[nv] = dist[v] + 1;
			que.push(nv);
		}
	}
*/

//グリッド型BFSテンプレ
/*

	vvint dist(H, vint(W, -1));
	dist[sx][sy] = 0;

	queue<pint> que;
	que.push({sx, sy});

	while (!que.empty()) {
		pint cu = que.front();
		que.pop();

		rep(i,4){
			int nx = cu.first + dx[i];
			int ny = cu.second + dy[i];
			if (nx < 0 || nx >= H || ny < 0 || ny >= W || S[nx][ny] == '#')
				continue;

			if (dist[nx][ny] == -1) {
				que.push({nx, ny});
				dist[nx][ny] = dist[cu.first][cu.second] + 1;
			}
		}
	}

	多点スタートなら
	rep(i,H){
		rep(j,W){
			if (S[i][j] == '#') {
				dist[i][j] = 0;
				que.push({ i, j });
			}
		}
	}
*/

//素因数分解する時のやつ
/*
const auto& res = prime_factorize(N);
for (auto p : res) {
}
*/

//グラフデバッグ
/*
REP(i, N) {
	cout << "G[" << i << "]=";
	rep(j, G[i].size)
		cout << G[i][j] << " ";
	cout << endl;
}
*/

// fixed << setprecision(15)<<
// << setw(2) << setfill('0')

/*
/*int NumberofDivsors(int N) {
	vector<pint> a = Prime_factorize(N);
	int ans = 1;
	for (pint p : a)
		ans *= p.second() + 1;
	return ans;
}
*/

//xor
/*
a^a=0
a^x^x == a
a^x == b^x  <=> a == b
a+b==a^b ⇔ a&b==0
a+b=a^b+2(a&b)

4a^(4a+1)^(4a+2)^(4a+3)=0
*/


0