結果
問題 | No.928 軽減税率? |
ユーザー |
![]() |
提出日時 | 2021-01-28 22:09:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 1,000 ms |
コード長 | 1,036 bytes |
コンパイル時間 | 1,684 ms |
コンパイル使用メモリ | 195,496 KB |
最終ジャッジ日時 | 2025-01-18 08:35:51 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:20:13: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized] 20 | int ans; | ^~~
ソースコード
#include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) begin(v),end(v) template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } using ll = long long; using pii = pair<int, int>; constexpr ll INF = 1ll<<30; constexpr ll longINF = 1ll<<60; constexpr ll MOD = 1000000007; constexpr bool debug = false; //---------------------------------// int main() { int P, Q, A; cin >> P >> Q >> A; constexpr int p10 = 1000000000; int ans; if (P == Q) ans = A == 0 ? 0 : p10; else if (P < Q) { if (A > 0) ans = p10; else { FOR(i, 1, 101) ans += Q * i / 100 > P * i / 100; ans += p10 - 100; } } else { for (int i = 1;; ++i) { int a = i + P * i / 100; int b = i + Q * i / 100 + A; ans += a < b; if (a - b >= 1) break; } } cout << ans << endl; }