結果
問題 | No.2194 兄弟の掛け引き |
ユーザー |
|
提出日時 | 2023-03-26 16:01:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 2,407 bytes |
コンパイル時間 | 1,549 ms |
コンパイル使用メモリ | 174,532 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-19 09:52:22 |
合計ジャッジ時間 | 2,123 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
#include <bits/stdc++.h>//#include <math.h>//#include<string>//#include <atcoder/all>//using namespace atcoder;#define _GLIBCXX_DEBUGusing namespace std;using ll = long long;#define rep(i, n) for (int i = 0; i < (int)(n); i++)#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)#define rrep(i,a,b) for(int i=a;i>=b;i--)#define V vector<ll>#define Vi vector<int>#define Vd vector<double>#define Vb vector<bool>#define Vs vector<string>#define Vc vector<char>#define VV vector<V>using P = pair<ll,ll>;using G = vector<vector<int>>;#define all(a) (a).begin(),(a).end()#define rall(a) (a).rbegin(),(a).rend()#define INF 1LL << 60template <typename T>bool chmax(T &a, const T& b) {if (a < b) {a = b; // aをbで更新return true;}return false;}template <typename T>bool chmin(T &a, const T& b) {if (a > b) {a = b; // aをbで更新return true;}return false;}long long combi(long long n, long long k) {if (n == k || k == 0)return 1;else {return combi(n - 1, k - 1) + combi(n - 1, k);}}//整数かどうかbool isNumber(const string& str){for (const char &c : str) {if (std::isdigit(c) == 0) return false;}return true;}//最大公約数int gcd(int a, int b){if(a%b == 0){return b;}else{return gcd(b, a%b);}}//最小公倍数int lcm(int a, int b){return a*b / gcd(a, b);}//int di[] = {-1,0,1,0};//int dj[] = {0,-1,0,1};//cout << fixed << setprecision(15) << y << endl;//s = regex_replace(s, regex("あ"), "う");/*//各桁の和int wa(int n){int sum =0;while(n>0){sum += n%10;n/=10;}return sum;}*//*//階乗int ki(int i){int k = 1;for(int j = 1; j<=i; j++){k *= j;}return k;}*///vector<int> dx = {1,0,-1,0,1,-1,-1,1};//vector<int> dy = {0,1,0,-1,1,1,-1,-1};//int dx[4] = { 0, 1, 0, -1 }, dy[4] = { -1, 0, 1, 0 };//#define mod 998244353//using mint = modint1000000007;//cout << mint.val() << endl;//using mint = modint998244353;#define yes "Yes"#define no "No"#define Yes "YES"#define No "NO"int main(){int a, b, c;cin >> a >> b >> c;int an1,an2;an1 = c/a;an2 = (b+c)/a;set<int>st;if(an1*a == c && an1*a-b<=0)st.insert(an1);if(an2*a- b == c && an2*a-b>0)st.insert(an2);if(st.size() < 1)cout << -1 << endl;else{for(auto e : st)cout << e << endl;}}