提出 #12605392
ソースコード 拡げる
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
//typedef boost::multiprecision::cpp_int bigint;
LL A, B, N;
LL func(LL x) {
return floor((LD)A * x / B) - A * floor((LD)x / B);
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
cin >> A >> B >> N;
LL ans = 0;
if (N < B) {
cout << func(N) << "\n";
}
else if (N == B) {
cout << func(N - 1) << "\n";
}
else {
cout << func(B - 1) << "\n";
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Floor Function |
| ユーザ | ano3 |
| 言語 | C++ (Clang 10.0.0) |
| 得点 | 400 |
| コード長 | 1263 Byte |
| 結果 | AC |
| 実行時間 | 4 ms |
| メモリ | 3168 KiB |
コンパイルエラー
./Main.cpp:51:5: warning: unused variable 'ans' [-Wunused-variable]
LL ans = 0;
^
./Main.cpp:29:17: warning: unused variable 'MOD' [-Wunused-const-variable]
const long long MOD = 1e9 + 7;
^
./Main.cpp:30:17: warning: unused variable 'INF' [-Wunused-const-variable]
const long long INF = 1e18;
^
3 warnings generated.
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 01.txt, 02.txt |
| All | 01.txt, 02.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01.txt | AC | 4 ms | 3092 KiB |
| 02.txt | AC | 2 ms | 3168 KiB |
| 11.txt | AC | 2 ms | 3068 KiB |
| 12.txt | AC | 2 ms | 3136 KiB |
| 13.txt | AC | 2 ms | 3160 KiB |
| 14.txt | AC | 1 ms | 3156 KiB |
| 15.txt | AC | 2 ms | 3096 KiB |
| 16.txt | AC | 2 ms | 3152 KiB |
| 17.txt | AC | 2 ms | 3156 KiB |
| 18.txt | AC | 1 ms | 3088 KiB |