結果
問題 |
No.316 もっと刺激的なFizzBuzzをください
|
ユーザー |
![]() |
提出日時 | 2025-02-05 01:22:01 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 1,896 bytes |
コンパイル時間 | 7,306 ms |
コンパイル使用メモリ | 309,884 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-02-05 01:22:11 |
合計ジャッジ時間 | 6,286 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define INF INT_MAX #define LINF LONG_LONG_MAX #define int long long #define all(a) a.begin(), a.end() #define f first #define s second #define vi vector<int> #define vvi vector<vector<int>> #define vvvi vector<vector<vector<int>>> #define vii vector<pair<int, int>> #define seed chrono::high_resolution_clock::now().time_since_epoch().count() #define file_read(filepath) freopen(filepath, "r", stdin); #define file_write(filepath) freopen(filepath, "w", stdout); #define fastio \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #define MOD 1000000007 using namespace std; using pii = pair<int, int>; using namespace __gnu_pbds; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template <typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template <typename T> void print(vector<T> &array, int size = numeric_limits<int>::max()) { for (int i = 0; i < min<int>(size, array.size()); i++) { cout << array[i] << " "; } cout << "\n"; } template <typename T> void print(T X) { cout << X << "\n"; } template <typename T, typename... Ts> void print(T X, Ts... Y) { cout << X << " "; print(Y...); } void solve() { int n; cin >> n; int a, b, c; cin >> a >> b >> c; int a1 = n / a; int a2 = n / b; int a3 = n / c; int a4 = n / lcm(a, b); int a5 = n / lcm(a, c); int a6 = n / lcm(b, c); int a7 = n / lcm(a, lcm(b, c)); int answer = a1 + a2 + a3 - a4 - a5 - a6 + a7; print(answer); } signed main() { fastio; int t = 1; // cin >> t; while (t--) { solve(); } return 0; }