Submission #1534193
Source Code Expand
#include "bits/stdc++.h" using namespace std; int main(){ int n; cin>>n; int x; long long int A=0; long long int B=0; for(int i=0;i<n;i++){ long long int t,a; cin>>t>>a; x=max(1,max(A/t,B/a)); while(A>t*x||B>a*x)x++; A=x*t; B=x*a; } cout<<A+B<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - AtCoDeer and Election Report |
User | shichinomiya |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 311 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:15:23: error: no matching function for call to ‘max(int, const long long int&)’ x=max(1,max(A/t,B/a)); ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/istream:38, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from ./Main.cpp:1: /usr/include/c++/5/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/5/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed: ./Main.cpp:15:23: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’) x=max(...