結果
問題 |
No.928 軽減税率?
|
ユーザー |
![]() |
提出日時 | 2019-11-22 23:31:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,957 bytes |
コンパイル時間 | 1,109 ms |
コンパイル使用メモリ | 102,272 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-10-11 13:02:30 |
合計ジャッジ時間 | 4,302 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 TLE * 1 -- * 13 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <iomanip> #include <string> #include <stack> #include <queue> #include <map> #include <set> #include <tuple> #include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cassert> #include <cstdint> #include <numeric> #include <bitset> #include <functional> using namespace std; using ll = long long; using Pll = pair<ll, ll>; using Pii = pair<int, int>; constexpr ll MOD = 1000000007; constexpr long double EPS = 1e-10; constexpr int dyx[4][2] = { { 0, 1}, {-1, 0}, {0,-1}, {1, 0} }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll p, q, a; cin >> p >> q >> a; if(p <= q) { ll ans = 1000000000; if(a == 0) { map<int , int> mp; for(int i=0;i<100;++i) { ++mp[(p * i / 100) - (q * i / 100)]; } // for(auto itr=mp.begin(); itr!=mp.end(); ++itr) { // cerr << (itr->first) << ": " << (itr->second) << endl; // } int i = 0; while((mp.rbegin()->first) - i * (q-p) >= 0) { for(auto itr=mp.begin(); itr!=mp.end(); ++itr) { if((itr->first) - i * (q-p)) ans -= (itr->second); } ++i; } } cout << ans << endl; return 0; } map<int , int> mp; for(int i=0;i<100;++i) { ++mp[(p * i / 100) - (q * i / 100)]; } // for(auto itr=mp.begin(); itr!=mp.end(); ++itr) { // cerr << (itr->first) << ": " << (itr->second) << endl; // } ll ans = (a - (mp.rbegin()->first))/(p-q) * 100; int i = (a - (mp.rbegin()->first))/(p-q); while((mp.begin()->first) + i * (p-q) < a) { for(auto itr=mp.begin(); itr!=mp.end(); ++itr) { if((itr->first) + i * (p-q) < a) ans += (itr->second); } ++i; } --ans; cout << ans << endl; }