結果

問題 No.1101 鼻水
ユーザー takumat
提出日時 2020-07-03 22:02:16
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 985 bytes
コンパイル時間 852 ms
コンパイル使用メモリ 96,072 KB
最終ジャッジ日時 2025-01-11 14:37:58
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;//998244353;

template<class _T> static void getval(_T& a) {
	std::cin >> a;
}
template<class _T> static void getval(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getval(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

static void exec()
{
	LLONG V, T, P;
	getval(V, T, P);
	
	if (P) {
		V = V * (P + 1);
	}
	LLONG rd = V / T;
	LLONG rdtmp = (rd + V % T) / T;
	LLONG surp = (rd + V % T) % T;
	rd += rdtmp;
	while (rdtmp) {
		LLONG n = (rdtmp + surp) / T;
		rd += n;
		surp = (rdtmp + surp) % T;
		rdtmp = n;
	}

	LLONG ans = V + rd + 1;

	printf("%lld\n", ans);
}
0