結果

問題 No.589 Counting Even
ユーザー agis
提出日時 2017-11-04 00:16:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 1,666 ms
コンパイル使用メモリ 165,196 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-23 15:28:04
合計ジャッジ時間 2,515 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

int main() {
	cin.sync_with_stdio(false);
	ll N;
	cin >> N;
	if (N == 0) {
		cout << 0 << endl;
		return 0;
	}

	ll n = N - 1;
	ll k = n / 8+1;
	ll x = n % 8;
	int m[8] = {0,1,0,3,2,3,0,7};
	ll ans = k*m[x];
	ans += (k - 1)*(7 - (x+1));
	cout << ans << endl;
	return 0;
}
0