結果

問題 No.415 ぴょん
ユーザー femto
提出日時 2016-08-26 22:49:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 647 ms
コンパイル使用メモリ 75,580 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-08 09:39:18
合計ジャッジ時間 1,516 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll N, D;
	cin >> N >> D;

	if(N % D == 0) {
		cout << N / D - 1 << endl;
		return 0;
	}

	ll skip = D - N % D;
	ll ans = 0;
	ans += N / D * D / skip;

	ll rem = N % D;
	ans += rem / skip;

	cout << ans - 1 << endl;
}
0