548 rows(这么多行)
@杨北辰 当然喽,所有高精度都在这里了
CE
#include<bits/stdc++.h>
using namespace std;
namespace BigINT{
#define digit int
#define ull unsigned long long
#define ll long long
class bigInt {digit *value;ull capacity;ull length;bool sign;private:inline void Genshin_Impact_start();inline void emplace_back(const digit &new_digit);inline void put_string(std::string from);inline void put_bigInt(const bigInt &from);inline void put_ull_interger(ull from, const bool &new_sign = 0);inline void put_ll_interger(const ll &from);inline void pop_zero();inline void negation();inline digit at(const int &idx) const;public:void reserve(ull new_cap);bigInt& operator =(const bigInt &from);bigInt& operator =(std::string from);bigInt& operator =(const ull &from);bigInt& operator =(const ll &from);bigInt& operator =(const unsigned int &from);bigInt& operator =(const int &from);bigInt() { Genshin_Impact_start(); }bigInt(std::string str) { put_string(str); }bigInt(const ull &from) { put_ull_interger(from, 0); }bigInt(const ll &from) { put_ll_interger(from); }bigInt(const unsigned int &from) { put_ull_interger(from, 0); }bigInt(const int &from) { put_ll_interger(from); }~bigInt() {delete[] value;}friend std::ostream& operator<<(std::ostream& out, const bigInt &num) {if (num.length == 0) {out << '0';return out;}if (num.sign == 1) out << '-';for (int idx = (num.length) - 1; idx >= 0; --idx) out << char(num.value[idx] + 48);return out;}friend std::istream& operator>>(std::istream& in, bigInt &num) {num.Genshin_Impact_start();char ch = in.get();while (ch < '0' || ch > '9') {if (ch == '-') num.sign = 1;ch = in.get();}while (ch >= '0' && ch <= '9') {num.emplace_back(ch ^ 48);ch = in.get();}for (int l = 0, r = num.length - 1; l < r; ++l, --r) std::swap(num.value[l], num.value[r]);num.pop_zero();return in;}inline ull size();inline ll to_digit();inline std::string to_string();inline bool operator==(const bigInt &other) const;inline bool operator<(const bigInt &other) const;inline bool operator>(const bigInt &other) const;inline bool operator<=(const bigInt &other) const;inline bool operator>=(const bigInt &other) const;inline bool operator!=(const bigInt &other) const;inline bigInt operator<<(const int &num);inline bigInt operator>>(const int &num);inline bigInt operator-() const;inline bigInt operator+(bigInt other);inline bigInt operator-(bigInt other);inline bigInt operator*(bigInt other);inline bigInt operator/(bigInt other);inline bigInt operator%(bigInt other);inline bigInt operator&(bigInt other);inline bigInt operator|(bigInt other);inline bigInt &operator<<=(const int &num);inline bigInt &operator>>=(const int &num);inline bigInt &operator+=(const bigInt &other);inline bigInt &operator-=(const bigInt &other);inline bigInt &operator*=(const bigInt &other);inline bigInt &operator/=(const bigInt &other);inline bigInt &operator%=(const bigInt &other);inline bigInt &operator&=(const bigInt &other);inline bigInt &operator|=(const bigInt &other);bigInt& operator++();bigInt operator++(int);bigInt& operator--();bigInt operator--(int);};inline void bigInt::Genshin_Impact_start() {this->sign = 0;this->capacity = 1;this->length = 0;this->value = new digit[1];this->reserve(-1);}void bigInt::reserve(ull new_cap = -1) {if (new_cap == -1) new_cap = (this->capacity) << 1;digit *past_value = this->value;this->capacity = new_cap;this->value = new digit[this->capacity];for (int idx = 0; idx < (this->length); ++idx) value[idx] = past_value[idx];for (int idx = (this->length); idx < new_cap; ++idx) { value[idx] = 0; }delete[] past_value;}inline void bigInt::put_string(std::string from) {this->Genshin_Impact_start();if (from.front() == '-') {sign = 1;from = from.substr(1);}for (const char &to_put : from) {this->emplace_back(to_put ^ 48);}for (int l = 0, r = this->length - 1; l < r; ++l, --r) std::swap(value[l], value[r]);this->pop_zero();}inline void bigInt::put_bigInt(const bigInt &from) {this->Genshin_Impact_start();for (int idx = 0; idx < from.length; ++idx) this->emplace_back(from.value[idx]);this->sign = from.sign;}inline void bigInt::put_ull_interger(ull from, const bool &new_sign) {this->Genshin_Impact_start();this->sign = new_sign;while (from) {this->emplace_back(from % 10);from /= 10;}this->pop_zero();}inline void bigInt::put_ll_interger(const ll &from) {if (from < 0) this->put_ull_interger((ull)-from, 1);else this->put_ull_interger(from, 0);}inline void bigInt::emplace_back(const digit &new_digit) {if ((this->length) == (this->capacity)) this->reserve();this->value[(this->length)++] = new_digit;}inline void bigInt::pop_zero() {while (length && this->value[length - 1] == 0) {--length;if (length == (capacity >> 1)) reserve(capacity >> 1);}}inline void bigInt::negation() { this->sign = !(this->sign); }inline digit bigInt::at(const int &idx) const {if (idx < length) return value[idx];else return 0;}bigInt &bigInt::operator=(const bigInt &from) { this->put_bigInt(from); return *this; }bigInt &bigInt::operator=(std::string from) { this->put_string(from); return *this; }bigInt &bigInt::operator=(const ull &from) { put_ull_interger(from, 0); return *this; }bigInt &bigInt::operator=(const ll &from) { put_ll_interger(from); return *this; }bigInt &bigInt::operator=(const unsigned int &from) { put_ull_interger(from, 0); return *this; }bigInt &bigInt::operator=(const int &from) { put_ll_interger(from); return *this; }inline ull bigInt::size() { return this->length; }inline ll bigInt::to_digit() {ll ans = 0, weight = 1;for (int i = 0; i < length; ++i) {ans += value[i] * weight;weight *= 10;}return (sign ? (-ans) : ans);}inline std::string bigInt::to_string() {std::string ans;if (sign) ans.push_back('-');for (int i = length - 1; i >= 0; --i) ans.push_back(value[i] + '0');return ans;}inline bool bigInt::operator==(const bigInt &other) const {if (this->length != other.length || this->sign != other.sign) return false;for (int idx = 0; idx < (this->length); ++idx) {if (this->value[idx] != other.value[idx]) return false;}return true;}inline bool bigInt::operator<(const bigInt &other) const {if (this->sign == 1 && other.sign == 0) return true;else if (this->sign == 0 && other.sign == 1) return false;else if (this->sign == 1 && other.sign == 1) return -(*this) > -other;if (this->length < other.length) return true;if (this->length > other.length) return false;for (int idx = (this->length) - 1; idx >= 0; --idx) {if (this->value[idx] > other.value[idx]) return false;if (this->value[idx] < other.value[idx]) return true;}return false;}inline bool bigInt::operator>(const bigInt &other) const {if (this->sign == 1 && other.sign == 0) return false;else if (this->sign == 0 && other.sign == 1) return true;else if (this->sign == 1 && other.sign == 1) return -(*this) < -other;if (this->length > other.length) return true;else if (this->length < other.length) return false;for (int idx = (this->length) - 1; idx >= 0; --idx) {if (this->value[idx] < other.value[idx]) return false;if (this->value[idx] > other.value[idx]) return true;}return false;}inline bool bigInt::operator<=(const bigInt &other) const { return !((*this) > other); }inline bool bigInt::operator>=(const bigInt &other) const { return !((*this) < other); }inline bool bigInt::operator!=(const bigInt &other) const { return !((*this) == other); }inline bigInt bigInt::operator<<(const int &num) {bigInt ans;ans.reserve(length + num);ans.length = ans.capacity;for (int i = 0; i < num; ++i) ans.value[i] = 0;for (int i = 0; i < length; ++i) ans.value[i + num] = value[i];ans.pop_zero();return ans;}inline bigInt bigInt::operator>>(const int &num) {if ((this->length) <= num) return bigInt();bigInt ans;ans.reserve(length - num);ans.length = ans.capacity;for (int i = num; i < length; ++i) ans.value[i - num] = value[i];ans.pop_zero();return ans;}inline bigInt bigInt::operator-() const {bigInt ans = (*this);ans.negation();return ans;}inline bigInt bigInt::operator+(bigInt other) {if (this->sign != other.sign) {if (this->sign == 1) {if (-(*this) > other) return -(-(*this) - other);else return other - (-(*this));}else if (this->sign == 0) {if ((*this) > -other) return (*this) - (-other);else return -(-other - (*this));}}if (other == 0) return (*this);bigInt ans;ans.reserve(std::max(other.length, this->length) + 1);ans.length = ans.capacity;for (int idx = 0; idx < ans.length; ++idx) {ans.value[idx] += this->at(idx) + other.at(idx);if (ans.value[idx] >= 10) {++ans.value[idx + 1];ans.value[idx] -= 10;}}ans.pop_zero();ans.sign = this->sign;return ans;}inline bigInt bigInt::operator-(bigInt other) {if (this->sign || other.sign) {if (this->sign == 0 && other.sign == 1) return (*this) + (-other);if (this->sign == 1) {if (other.sign == 0) {return -(-(*this) + other);}else {return (*this) + (-other);}}}if (other == 0) return (*this);if ((*this) < other) return -(other - (*this));bigInt ans;ans.reserve(this->length);ans.length = ans.capacity;for (int idx = 0; idx < (this->length); ++idx) {ans.value[idx] += this->at(idx) - other.at(idx);if (ans.value[idx] < 0) {--ans.value[idx + 1];ans.value[idx] += 10;}}return ans;}inline bigInt bigInt::operator*(bigInt other) {bigInt ans;int now;ans.reserve(this->length + other.length);ans.length = ans.capacity;for (int idx_this = 0; idx_this < (this->length); ++idx_this) {for (int idx_other = 0; idx_other < other.length; ++idx_other) {now = idx_this + idx_other;ans.value[now] += (this->at(idx_this)) * other.at(idx_other);if (ans.value[now] >= 10) {ans.value[now + 1] += (ans.value[now]) / 10;ans.value[now] %= 10;}}}ans.pop_zero();ans.sign = (this->sign) != other.sign;return ans;}inline bigInt bigInt::operator/(bigInt other) {if (other == bigInt(0)) {std::cerr << "Error: Divide by zero!" << std::endl;throw std::invalid_argument("Divide by zero!");}else if ((*this) == bigInt(0)) return 0;else if ((*this) < other) return 0;bigInt ans, cur, divi = (*this);int l, r, mid;ans.reserve((this->length) - other.length + 1);ans.length = ans.capacity;for (int idx = ans.length - 1; idx >= 0; --idx) {cur = divi >> idx;l = 0, r = 9;while (l < r) {mid = l + r + 1 >> 1;if (other * mid <= cur) l = mid;else r = mid - 1;}mid = l;ans.value[idx] = l;divi = divi - ((other * mid) << idx);divi.pop_zero();}ans.pop_zero();ans.sign = (this->sign) != other.sign;return ans;}inline bigInt bigInt::operator%(bigInt other) {if (other == bigInt(0)) {std::cerr << "Error: Divide by zero!" << std::endl;throw std::invalid_argument("Divide by zero!");}else if ((*this) == bigInt(0)) return 0;bigInt cur, divi = (*this);int l, r, mid;for (int idx = ((this->length) - other.length); idx >= 0; --idx) {cur = divi >> idx;l = 0, r = 9;while (l < r) {mid = l + r + 1 >> 1;if (other * mid <= cur) l = mid;else r = mid - 1;}mid = l;divi = divi - (other * mid << idx);divi.pop_zero();}return divi;}inline bigInt &bigInt::operator<<=(const int &num) { return ((*this) = (*this) << num); }inline bigInt &bigInt::operator>>=(const int &num) { return ((*this) = (*this) >> num); }inline bigInt &bigInt::operator+=(const bigInt &num) { return ((*this) = (*this) + num); }inline bigInt &bigInt::operator-=(const bigInt &num) { return ((*this) = (*this) - num); }inline bigInt &bigInt::operator*=(const bigInt &num) { return ((*this) = (*this) * num); }inline bigInt &bigInt::operator/=(const bigInt &num) { return ((*this) = (*this) / num); }inline bigInt &bigInt::operator%=(const bigInt &num) { return ((*this) = (*this) % num); }inline bigInt bigInt::operator&(bigInt other) {bigInt ans;ans.reserve(std::max(this->length, other.length));ans.length = ans.capacity;for (int i = 0; i < ans.length; ++i) {ans.value[i] = this->at(i) & other.at(i);}ans.pop_zero();ans.sign = this->sign & other.sign;return ans;}inline bigInt bigInt::operator|(bigInt other) {bigInt ans;ans.reserve(std::max(this->length, other.length));ans.length = ans.capacity;for (int i = 0; i < ans.length; ++i) {ans.value[i] = this->at(i) | other.at(i);}ans.pop_zero();ans.sign = this->sign | other.sign;return ans;}inline bigInt &bigInt::operator&=(const bigInt &other) {return (*this = *this & other);}inline bigInt &bigInt::operator|=(const bigInt &other) {return (*this = *this | other);}bigInt& bigInt::operator++() {*this += bigInt(1);return *this;}bigInt bigInt::operator++(int) {bigInt temp = *this;++(*this);return temp;}bigInt& bigInt::operator--() {*this -= bigInt(1);return *this;}bigInt bigInt::operator--(int) {bigInt temp = *this;--(*this);return temp;}
}using namespace BigINT;
#define int bigInt
struct node{
int z,y;
}a[1001];
bool cmp(node a,node b){
return a.z<b.z;
}
int n,a1,b1;
int sum[1001],ma=-100;
signed main(){
cin>>n>>a1>>b1;
for(int i=1;i<=n;i++) cin>>a[i].z>>a[i].y;
sort(a+1,a+n+1,cmp);
sum[0]=a1;
for(int i=1;i<=n;i++){
sum[i]=sum[i-1]*a[i].z;
ma=max((int)(sum[i-1]/a[i].y),ma);
}
for(int i=0;i<n;i++) cout<<ans1[i];
}
能不能只要乘法和加法的啊…
哪里CE了
这。
掐头去尾留乘除:
namespace BigINT
{
#define digit int
#define ull unsigned long long
#define ll long long
class bigInt
{
digit *value;
ull capacity;
ull length;
bool sign;
private:
inline void Genshin_Impact_start();
inline void emplace_back(const digit &new_digit);
inline void put_string(std::string from);
inline void put_bigInt(const bigInt &from);
inline void put_ull_interger(ull from, const bool &new_sign = 0);
inline void put_ll_interger(const ll &from);
inline void pop_zero();
inline void negation();
inline digit at(const int &idx) const;
public:
void reserve(ull new_cap);
bigInt &operator=(const bigInt &from);
bigInt &operator=(std::string from);
bigInt &operator=(const ull &from);
bigInt &operator=(const ll &from);
bigInt &operator=(const unsigned int &from);
bigInt &operator=(const int &from);
bigInt() { Genshin_Impact_start(); }
bigInt(std::string str) { put_string(str); }
bigInt(const ull &from) { put_ull_interger(from, 0); }
bigInt(const ll &from) { put_ll_interger(from); }
bigInt(const unsigned int &from) { put_ull_interger(from, 0); }
bigInt(const int &from) { put_ll_interger(from); }
~bigInt() { delete[] value; }
friend std::ostream &operator<<(std::ostream &out, const bigInt &num)
{
if (num.length == 0)
{
out << '0';
return out;
}
if (num.sign == 1)
out << '-';
for (int idx = (num.length) - 1; idx >= 0; --idx)
out << char(num.value[idx] + 48);
return out;
}
friend std::istream &operator>>(std::istream &in, bigInt &num)
{
num.Genshin_Impact_start();
char ch = in.get();
while (ch < '0' || ch > '9')
{
if (ch == '-')
num.sign = 1;
ch = in.get();
}
while (ch >= '0' && ch <= '9')
{
num.emplace_back(ch ^ 48);
ch = in.get();
}
for (int l = 0, r = num.length - 1; l < r; ++l, --r)
std::swap(num.value[l], num.value[r]);
num.pop_zero();
return in;
}
inline ull size();
inline ll to_digit();
inline std::string to_string();
inline bool operator==(const bigInt &other) const;
inline bool operator<(const bigInt &other) const;
inline bool operator>(const bigInt &other) const;
inline bool operator<=(const bigInt &other) const;
inline bool operator>=(const bigInt &other) const;
inline bool operator!=(const bigInt &other) const;
inline bigInt operator<<(const int &num);
inline bigInt operator>>(const int &num);
inline bigInt operator-() const;
inline bigInt operator+(bigInt other);
inline bigInt operator-(bigInt other);
inline bigInt operator*(bigInt other);
inline bigInt operator/(bigInt other);
inline bigInt operator%(bigInt other);
inline bigInt operator&(bigInt other);
inline bigInt operator|(bigInt other);
inline bigInt &operator<<=(const int &num);
inline bigInt &operator>>=(const int &num);
inline bigInt &operator+=(const bigInt &other);
inline bigInt &operator-=(const bigInt &other);
inline bigInt &operator*=(const bigInt &other);
inline bigInt &operator/=(const bigInt &other);
inline bigInt &operator%=(const bigInt &other);
inline bigInt &operator&=(const bigInt &other);
inline bigInt &operator|=(const bigInt &other);
bigInt &operator++();
bigInt operator++(int);
bigInt &operator--();
bigInt operator--(int);
};
inline void bigInt::Genshin_Impact_start()
{
this->sign = 0;
this->capacity = 1;
this->length = 0;
this->value = new digit[1];
this->reserve(-1);
}
void bigInt::reserve(ull new_cap = -1)
{
if (new_cap == -1)
new_cap = (this->capacity) << 1;
digit *past_value = this->value;
this->capacity = new_cap;
this->value = new digit[this->capacity];
for (int idx = 0; idx < (this->length); ++idx)
value[idx] = past_value[idx];
for (int idx = (this->length); idx < new_cap; ++idx)
{
value[idx] = 0;
}
delete[] past_value;
}
inline void bigInt::put_string(std::string from)
{
this->Genshin_Impact_start();
if (from.front() == '-')
{
sign = 1;
from = from.substr(1);
}
for (const char &to_put : from)
{
this->emplace_back(to_put ^ 48);
}
for (int l = 0, r = this->length - 1; l < r; ++l, --r)
std::swap(value[l], value[r]);
this->pop_zero();
}
inline void bigInt::put_bigInt(const bigInt &from)
{
this->Genshin_Impact_start();
for (int idx = 0; idx < from.length; ++idx)
this->emplace_back(from.value[idx]);
this->sign = from.sign;
}
inline void bigInt::put_ull_interger(ull from, const bool &new_sign)
{
this->Genshin_Impact_start();
this->sign = new_sign;
while (from)
{
this->emplace_back(from % 10);
from /= 10;
}
this->pop_zero();
}
inline void bigInt::put_ll_interger(const ll &from)
{
if (from < 0)
this->put_ull_interger((ull)-from, 1);
else
this->put_ull_interger(from, 0);
}
inline void bigInt::emplace_back(const digit &new_digit)
{
if ((this->length) == (this->capacity))
this->reserve();
this->value[(this->length)++] = new_digit;
}
inline void bigInt::pop_zero()
{
while (length && this->value[length - 1] == 0)
{
--length;
if (length == (capacity >> 1))
reserve(capacity >> 1);
}
}
inline void bigInt::negation() { this->sign = !(this->sign); }
inline digit bigInt::at(const int &idx) const
{
if (idx < length)
return value[idx];
else
return 0;
}
bigInt &bigInt::operator=(const bigInt &from)
{
this->put_bigInt(from);
return *this;
}
bigInt &bigInt::operator=(std::string from)
{
this->put_string(from);
return *this;
}
bigInt &bigInt::operator=(const ull &from)
{
put_ull_interger(from, 0);
return *this;
}
bigInt &bigInt::operator=(const ll &from)
{
put_ll_interger(from);
return *this;
}
bigInt &bigInt::operator=(const unsigned int &from)
{
put_ull_interger(from, 0);
return *this;
}
bigInt &bigInt::operator=(const int &from)
{
put_ll_interger(from);
return *this;
}
inline ull bigInt::size() { return this->length; }
inline ll bigInt::to_digit()
{
ll ans = 0, weight = 1;
for (int i = 0; i < length; ++i)
{
ans += value[i] * weight;
weight *= 10;
}
return (sign ? (-ans) : ans);
}
inline std::string bigInt::to_string()
{
std::string ans;
if (sign)
ans.push_back('-');
for (int i = length - 1; i >= 0; --i)
ans.push_back(value[i] + '0');
return ans;
}
inline bool bigInt::operator==(const bigInt &other) const
{
if (this->length != other.length || this->sign != other.sign)
return false;
for (int idx = 0; idx < (this->length); ++idx)
{
if (this->value[idx] != other.value[idx])
return false;
}
return true;
}
inline bool bigInt::operator<(const bigInt &other) const
{
if (this->sign == 1 && other.sign == 0)
return true;
else if (this->sign == 0 && other.sign == 1)
return false;
else if (this->sign == 1 && other.sign == 1)
return -(*this) > -other;
if (this->length < other.length)
return true;
if (this->length > other.length)
return false;
for (int idx = (this->length) - 1; idx >= 0; --idx)
{
if (this->value[idx] > other.value[idx])
return false;
if (this->value[idx] < other.value[idx])
return true;
}
return false;
}
inline bool bigInt::operator>(const bigInt &other) const
{
if (this->sign == 1 && other.sign == 0)
return false;
else if (this->sign == 0 && other.sign == 1)
return true;
else if (this->sign == 1 && other.sign == 1)
return -(*this) < -other;
if (this->length > other.length)
return true;
else if (this->length < other.length)
return false;
for (int idx = (this->length) - 1; idx >= 0; --idx)
{
if (this->value[idx] < other.value[idx])
return false;
if (this->value[idx] > other.value[idx])
return true;
}
return false;
}
inline bool bigInt::operator<=(const bigInt &other) const { return !((*this) > other); }
inline bool bigInt::operator>=(const bigInt &other) const { return !((*this) < other); }
inline bool bigInt::operator!=(const bigInt &other) const { return !((*this) == other); }
inline bigInt bigInt::operator<<(const int &num)
{
bigInt ans;
ans.reserve(length + num);
ans.length = ans.capacity;
for (int i = 0; i < num; ++i)
ans.value[i] = 0;
for (int i = 0; i < length; ++i)
ans.value[i + num] = value[i];
ans.pop_zero();
return ans;
}
inline bigInt bigInt::operator*(bigInt other)
{
bigInt ans;
int now;
ans.reserve(this->length + other.length);
ans.length = ans.capacity;
for (int idx_this = 0; idx_this < (this->length); ++idx_this)
{
for (int idx_other = 0; idx_other < other.length; ++idx_other)
{
now = idx_this + idx_other;
ans.value[now] += (this->at(idx_this)) * other.at(idx_other);
if (ans.value[now] >= 10)
{
ans.value[now + 1] += (ans.value[now]) / 10;
ans.value[now] %= 10;
}
}
}
ans.pop_zero();
ans.sign = (this->sign) != other.sign;
return ans;
}
inline bigInt bigInt::operator/(bigInt other)
{
if (other == bigInt(0))
{
std::cerr << "Error: Divide by zero!" << std::endl;
throw std::invalid_argument("Divide by zero!");
}
else if ((*this) == bigInt(0))
return 0;
else if ((*this) < other)
return 0;
bigInt ans, cur, divi = (*this);
int l, r, mid;
ans.reserve((this->length) - other.length + 1);
ans.length = ans.capacity;
for (int idx = ans.length - 1; idx >= 0; --idx)
{
cur = divi >> idx;
l = 0, r = 9;
while (l < r)
{
mid = l + r + 1 >> 1;
if (other * mid <= cur)
l = mid;
else
r = mid - 1;
}
mid = l;
ans.value[idx] = l;
divi = divi - ((other * mid) << idx);
divi.pop_zero();
}
ans.pop_zero();
ans.sign = (this->sign) != other.sign;
return ans;
}
inline bigInt &bigInt::operator*=(const bigInt &num) { return ((*this) = (*this) * num); }
inline bigInt &bigInt::operator/=(const bigInt &num) { return ((*this) = (*this) / num); }
}
using namespace BigINT;
@连晨皓 哎呀你真的直接复制看也不看呀!
@连晨皓 这里改成 for(int i=1;i<=n;i+=1)
就行了
一样
#include<bits/stdc++.h>
using namespace std;
namespace BigINT{
#define digit int
#define ull unsigned long long
#define ll long long
class bigInt {digit *value;ull capacity;ull length;bool sign;private:inline void Genshin_Impact_start();inline void emplace_back(const digit &new_digit);inline void put_string(std::string from);inline void put_bigInt(const bigInt &from);inline void put_ull_interger(ull from, const bool &new_sign = 0);inline void put_ll_interger(const ll &from);inline void pop_zero();inline void negation();inline digit at(const int &idx) const;public:void reserve(ull new_cap);bigInt& operator =(const bigInt &from);bigInt& operator =(std::string from);bigInt& operator =(const ull &from);bigInt& operator =(const ll &from);bigInt& operator =(const unsigned int &from);bigInt& operator =(const int &from);bigInt() { Genshin_Impact_start(); }bigInt(std::string str) { put_string(str); }bigInt(const ull &from) { put_ull_interger(from, 0); }bigInt(const ll &from) { put_ll_interger(from); }bigInt(const unsigned int &from) { put_ull_interger(from, 0); }bigInt(const int &from) { put_ll_interger(from); }~bigInt() {delete[] value;}friend std::ostream& operator<<(std::ostream& out, const bigInt &num) {if (num.length == 0) {out << '0';return out;}if (num.sign == 1) out << '-';for (int idx = (num.length) - 1; idx >= 0; --idx) out << char(num.value[idx] + 48);return out;}friend std::istream& operator>>(std::istream& in, bigInt &num) {num.Genshin_Impact_start();char ch = in.get();while (ch < '0' || ch > '9') {if (ch == '-') num.sign = 1;ch = in.get();}while (ch >= '0' && ch <= '9') {num.emplace_back(ch ^ 48);ch = in.get();}for (int l = 0, r = num.length - 1; l < r; ++l, --r) std::swap(num.value[l], num.value[r]);num.pop_zero();return in;}inline ull size();inline ll to_digit();inline std::string to_string();inline bool operator==(const bigInt &other) const;inline bool operator<(const bigInt &other) const;inline bool operator>(const bigInt &other) const;inline bool operator<=(const bigInt &other) const;inline bool operator>=(const bigInt &other) const;inline bool operator!=(const bigInt &other) const;inline bigInt operator<<(const int &num);inline bigInt operator>>(const int &num);inline bigInt operator-() const;inline bigInt operator+(bigInt other);inline bigInt operator-(bigInt other);inline bigInt operator*(bigInt other);inline bigInt operator/(bigInt other);inline bigInt operator%(bigInt other);inline bigInt operator&(bigInt other);inline bigInt operator|(bigInt other);inline bigInt &operator<<=(const int &num);inline bigInt &operator>>=(const int &num);inline bigInt &operator+=(const bigInt &other);inline bigInt &operator-=(const bigInt &other);inline bigInt &operator*=(const bigInt &other);inline bigInt &operator/=(const bigInt &other);inline bigInt &operator%=(const bigInt &other);inline bigInt &operator&=(const bigInt &other);inline bigInt &operator|=(const bigInt &other);bigInt& operator++();bigInt operator++(int);bigInt& operator--();bigInt operator--(int);};inline void bigInt::Genshin_Impact_start() {this->sign = 0;this->capacity = 1;this->length = 0;this->value = new digit[1];this->reserve(-1);}void bigInt::reserve(ull new_cap = -1) {if (new_cap == -1) new_cap = (this->capacity) << 1;digit *past_value = this->value;this->capacity = new_cap;this->value = new digit[this->capacity];for (int idx = 0; idx < (this->length); ++idx) value[idx] = past_value[idx];for (int idx = (this->length); idx < new_cap; ++idx) { value[idx] = 0; }delete[] past_value;}inline void bigInt::put_string(std::string from) {this->Genshin_Impact_start();if (from.front() == '-') {sign = 1;from = from.substr(1);}for (const char &to_put : from) {this->emplace_back(to_put ^ 48);}for (int l = 0, r = this->length - 1; l < r; ++l, --r) std::swap(value[l], value[r]);this->pop_zero();}inline void bigInt::put_bigInt(const bigInt &from) {this->Genshin_Impact_start();for (int idx = 0; idx < from.length; ++idx) this->emplace_back(from.value[idx]);this->sign = from.sign;}inline void bigInt::put_ull_interger(ull from, const bool &new_sign) {this->Genshin_Impact_start();this->sign = new_sign;while (from) {this->emplace_back(from % 10);from /= 10;}this->pop_zero();}inline void bigInt::put_ll_interger(const ll &from) {if (from < 0) this->put_ull_interger((ull)-from, 1);else this->put_ull_interger(from, 0);}inline void bigInt::emplace_back(const digit &new_digit) {if ((this->length) == (this->capacity)) this->reserve();this->value[(this->length)++] = new_digit;}inline void bigInt::pop_zero() {while (length && this->value[length - 1] == 0) {--length;if (length == (capacity >> 1)) reserve(capacity >> 1);}}inline void bigInt::negation() { this->sign = !(this->sign); }inline digit bigInt::at(const int &idx) const {if (idx < length) return value[idx];else return 0;}bigInt &bigInt::operator=(const bigInt &from) { this->put_bigInt(from); return *this; }bigInt &bigInt::operator=(std::string from) { this->put_string(from); return *this; }bigInt &bigInt::operator=(const ull &from) { put_ull_interger(from, 0); return *this; }bigInt &bigInt::operator=(const ll &from) { put_ll_interger(from); return *this; }bigInt &bigInt::operator=(const unsigned int &from) { put_ull_interger(from, 0); return *this; }bigInt &bigInt::operator=(const int &from) { put_ll_interger(from); return *this; }inline ull bigInt::size() { return this->length; }inline ll bigInt::to_digit() {ll ans = 0, weight = 1;for (int i = 0; i < length; ++i) {ans += value[i] * weight;weight *= 10;}return (sign ? (-ans) : ans);}inline std::string bigInt::to_string() {std::string ans;if (sign) ans.push_back('-');for (int i = length - 1; i >= 0; --i) ans.push_back(value[i] + '0');return ans;}inline bool bigInt::operator==(const bigInt &other) const {if (this->length != other.length || this->sign != other.sign) return false;for (int idx = 0; idx < (this->length); ++idx) {if (this->value[idx] != other.value[idx]) return false;}return true;}inline bool bigInt::operator<(const bigInt &other) const {if (this->sign == 1 && other.sign == 0) return true;else if (this->sign == 0 && other.sign == 1) return false;else if (this->sign == 1 && other.sign == 1) return -(*this) > -other;if (this->length < other.length) return true;if (this->length > other.length) return false;for (int idx = (this->length) - 1; idx >= 0; --idx) {if (this->value[idx] > other.value[idx]) return false;if (this->value[idx] < other.value[idx]) return true;}return false;}inline bool bigInt::operator>(const bigInt &other) const {if (this->sign == 1 && other.sign == 0) return false;else if (this->sign == 0 && other.sign == 1) return true;else if (this->sign == 1 && other.sign == 1) return -(*this) < -other;if (this->length > other.length) return true;else if (this->length < other.length) return false;for (int idx = (this->length) - 1; idx >= 0; --idx) {if (this->value[idx] < other.value[idx]) return false;if (this->value[idx] > other.value[idx]) return true;}return false;}inline bool bigInt::operator<=(const bigInt &other) const { return !((*this) > other); }inline bool bigInt::operator>=(const bigInt &other) const { return !((*this) < other); }inline bool bigInt::operator!=(const bigInt &other) const { return !((*this) == other); }inline bigInt bigInt::operator<<(const int &num) {bigInt ans;ans.reserve(length + num);ans.length = ans.capacity;for (int i = 0; i < num; ++i) ans.value[i] = 0;for (int i = 0; i < length; ++i) ans.value[i + num] = value[i];ans.pop_zero();return ans;}inline bigInt bigInt::operator>>(const int &num) {if ((this->length) <= num) return bigInt();bigInt ans;ans.reserve(length - num);ans.length = ans.capacity;for (int i = num; i < length; ++i) ans.value[i - num] = value[i];ans.pop_zero();return ans;}inline bigInt bigInt::operator-() const {bigInt ans = (*this);ans.negation();return ans;}inline bigInt bigInt::operator+(bigInt other) {if (this->sign != other.sign) {if (this->sign == 1) {if (-(*this) > other) return -(-(*this) - other);else return other - (-(*this));}else if (this->sign == 0) {if ((*this) > -other) return (*this) - (-other);else return -(-other - (*this));}}if (other == 0) return (*this);bigInt ans;ans.reserve(std::max(other.length, this->length) + 1);ans.length = ans.capacity;for (int idx = 0; idx < ans.length; ++idx) {ans.value[idx] += this->at(idx) + other.at(idx);if (ans.value[idx] >= 10) {++ans.value[idx + 1];ans.value[idx] -= 10;}}ans.pop_zero();ans.sign = this->sign;return ans;}inline bigInt bigInt::operator-(bigInt other) {if (this->sign || other.sign) {if (this->sign == 0 && other.sign == 1) return (*this) + (-other);if (this->sign == 1) {if (other.sign == 0) {return -(-(*this) + other);}else {return (*this) + (-other);}}}if (other == 0) return (*this);if ((*this) < other) return -(other - (*this));bigInt ans;ans.reserve(this->length);ans.length = ans.capacity;for (int idx = 0; idx < (this->length); ++idx) {ans.value[idx] += this->at(idx) - other.at(idx);if (ans.value[idx] < 0) {--ans.value[idx + 1];ans.value[idx] += 10;}}return ans;}inline bigInt bigInt::operator*(bigInt other) {bigInt ans;int now;ans.reserve(this->length + other.length);ans.length = ans.capacity;for (int idx_this = 0; idx_this < (this->length); ++idx_this) {for (int idx_other = 0; idx_other < other.length; ++idx_other) {now = idx_this + idx_other;ans.value[now] += (this->at(idx_this)) * other.at(idx_other);if (ans.value[now] >= 10) {ans.value[now + 1] += (ans.value[now]) / 10;ans.value[now] %= 10;}}}ans.pop_zero();ans.sign = (this->sign) != other.sign;return ans;}inline bigInt bigInt::operator/(bigInt other) {if (other == bigInt(0)) {std::cerr << "Error: Divide by zero!" << std::endl;throw std::invalid_argument("Divide by zero!");}else if ((*this) == bigInt(0)) return 0;else if ((*this) < other) return 0;bigInt ans, cur, divi = (*this);int l, r, mid;ans.reserve((this->length) - other.length + 1);ans.length = ans.capacity;for (int idx = ans.length - 1; idx >= 0; --idx) {cur = divi >> idx;l = 0, r = 9;while (l < r) {mid = l + r + 1 >> 1;if (other * mid <= cur) l = mid;else r = mid - 1;}mid = l;ans.value[idx] = l;divi = divi - ((other * mid) << idx);divi.pop_zero();}ans.pop_zero();ans.sign = (this->sign) != other.sign;return ans;}inline bigInt bigInt::operator%(bigInt other) {if (other == bigInt(0)) {std::cerr << "Error: Divide by zero!" << std::endl;throw std::invalid_argument("Divide by zero!");}else if ((*this) == bigInt(0)) return 0;bigInt cur, divi = (*this);int l, r, mid;for (int idx = ((this->length) - other.length); idx >= 0; --idx) {cur = divi >> idx;l = 0, r = 9;while (l < r) {mid = l + r + 1 >> 1;if (other * mid <= cur) l = mid;else r = mid - 1;}mid = l;divi = divi - (other * mid << idx);divi.pop_zero();}return divi;}inline bigInt &bigInt::operator<<=(const int &num) { return ((*this) = (*this) << num); }inline bigInt &bigInt::operator>>=(const int &num) { return ((*this) = (*this) >> num); }inline bigInt &bigInt::operator+=(const bigInt &num) { return ((*this) = (*this) + num); }inline bigInt &bigInt::operator-=(const bigInt &num) { return ((*this) = (*this) - num); }inline bigInt &bigInt::operator*=(const bigInt &num) { return ((*this) = (*this) * num); }inline bigInt &bigInt::operator/=(const bigInt &num) { return ((*this) = (*this) / num); }inline bigInt &bigInt::operator%=(const bigInt &num) { return ((*this) = (*this) % num); }inline bigInt bigInt::operator&(bigInt other) {bigInt ans;ans.reserve(std::max(this->length, other.length));ans.length = ans.capacity;for (int i = 0; i < ans.length; ++i) {ans.value[i] = this->at(i) & other.at(i);}ans.pop_zero();ans.sign = this->sign & other.sign;return ans;}inline bigInt bigInt::operator|(bigInt other) {bigInt ans;ans.reserve(std::max(this->length, other.length));ans.length = ans.capacity;for (int i = 0; i < ans.length; ++i) {ans.value[i] = this->at(i) | other.at(i);}ans.pop_zero();ans.sign = this->sign | other.sign;return ans;}inline bigInt &bigInt::operator&=(const bigInt &other) {return (*this = *this & other);}inline bigInt &bigInt::operator|=(const bigInt &other) {return (*this = *this | other);}bigInt& bigInt::operator++() {*this += bigInt(1);return *this;}bigInt bigInt::operator++(int) {bigInt temp = *this;++(*this);return temp;}bigInt& bigInt::operator--() {*this -= bigInt(1);return *this;}bigInt bigInt::operator--(int) {bigInt temp = *this;--(*this);return temp;}
}using namespace BigINT;
#define int bigInt
struct node{
int z,y;
}a[1001];
bool cmp(node a,node b){
return a.z<b.z;
}
int n,a1,b1;
int sum[1001],ma=-100;
signed main(){
cin>>n>>a1>>b1;
for(int i=1;i<=n;i+=1) cin>>a[i].z>>a[i].y;
sort(a+1,a+n+1,cmp);
sum[0]=a1;
for(int i=1;i<=n;i+=1){
sum[i]=sum[i-1]*a[i].z;
ma=max((int)(sum[i-1]/a[i].y),ma);
}
cout<<ma;
}
@连晨皓 那里报错?
signed n, a1, b1;
int sum[1001], ma = -100;
signed main()
{
cin >> n >> a1 >> b1;
for (signed i = 1; i <= n; i++)
cin >> a[i].z >> a[i].y;
sort(a + 1, a + n + 1, cmp);
sum[0] = a1;
for (signed i = 1; i <= n; i++)
{
sum[i] = sum[i - 1] * a[i].z;
ma = max((int)(sum[i - 1] / a[i].y), ma);
}
for (signed i = 0; i < n; i++)
cout << ans1[i];
}
@连晨皓 o我知道哪里有问题了!等一下
有些地方改signed
有些地方改成signed就好了
还有,ans1未定义
@连晨皓 你不要加那个define 了!哪里需要高精度就写哪里,把 define 去掉
signed n, a1, b1;
int sum[1001], ma = -100;
signed main()
{
cin >> n >> a1 >> b1;
for (signed i = 1; i <= n; i++)
cin >> a[i].z >> a[i].y;
sort(a + 1, a + n + 1, cmp);
sum[0] = a1;
for (signed i = 1; i <= n; i++)
{
sum[i] = sum[i - 1] * a[i].z;
ma = max((int)(sum[i - 1] / a[i].y), ma);
}
for (signed i = 0; i < n; i++)
cout << sum[i];
return 0;
}
帮你改好了(吧
帮你改成cout<<sum[i]
了,原来是ans1[i]
(不知道对不对
CE*3
#include<bits/stdc++.h>
using namespace std;
namespace BigINT{
#define digit int
#define ull unsigned long long
#define ll long long
class bigInt {digit *value;ull capacity;ull length;bool sign;private:inline void Genshin_Impact_start();inline void emplace_back(const digit &new_digit);inline void put_string(std::string from);inline void put_bigInt(const bigInt &from);inline void put_ull_interger(ull from, const bool &new_sign = 0);inline void put_ll_interger(const ll &from);inline void pop_zero();inline void negation();inline digit at(const int &idx) const;public:void reserve(ull new_cap);bigInt& operator =(const bigInt &from);bigInt& operator =(std::string from);bigInt& operator =(const ull &from);bigInt& operator =(const ll &from);bigInt& operator =(const unsigned int &from);bigInt& operator =(const int &from);bigInt() { Genshin_Impact_start(); }bigInt(std::string str) { put_string(str); }bigInt(const ull &from) { put_ull_interger(from, 0); }bigInt(const ll &from) { put_ll_interger(from); }bigInt(const unsigned int &from) { put_ull_interger(from, 0); }bigInt(const int &from) { put_ll_interger(from); }~bigInt() {delete[] value;}friend std::ostream& operator<<(std::ostream& out, const bigInt &num) {if (num.length == 0) {out << '0';return out;}if (num.sign == 1) out << '-';for (int idx = (num.length) - 1; idx >= 0; --idx) out << char(num.value[idx] + 48);return out;}friend std::istream& operator>>(std::istream& in, bigInt &num) {num.Genshin_Impact_start();char ch = in.get();while (ch < '0' || ch > '9') {if (ch == '-') num.sign = 1;ch = in.get();}while (ch >= '0' && ch <= '9') {num.emplace_back(ch ^ 48);ch = in.get();}for (int l = 0, r = num.length - 1; l < r; ++l, --r) std::swap(num.value[l], num.value[r]);num.pop_zero();return in;}inline ull size();inline ll to_digit();inline std::string to_string();inline bool operator==(const bigInt &other) const;inline bool operator<(const bigInt &other) const;inline bool operator>(const bigInt &other) const;inline bool operator<=(const bigInt &other) const;inline bool operator>=(const bigInt &other) const;inline bool operator!=(const bigInt &other) const;inline bigInt operator<<(const int &num);inline bigInt operator>>(const int &num);inline bigInt operator-() const;inline bigInt operator+(bigInt other);inline bigInt operator-(bigInt other);inline bigInt operator*(bigInt other);inline bigInt operator/(bigInt other);inline bigInt operator%(bigInt other);inline bigInt operator&(bigInt other);inline bigInt operator|(bigInt other);inline bigInt &operator<<=(const int &num);inline bigInt &operator>>=(const int &num);inline bigInt &operator+=(const bigInt &other);inline bigInt &operator-=(const bigInt &other);inline bigInt &operator*=(const bigInt &other);inline bigInt &operator/=(const bigInt &other);inline bigInt &operator%=(const bigInt &other);inline bigInt &operator&=(const bigInt &other);inline bigInt &operator|=(const bigInt &other);bigInt& operator++();bigInt operator++(int);bigInt& operator--();bigInt operator--(int);};inline void bigInt::Genshin_Impact_start() {this->sign = 0;this->capacity = 1;this->length = 0;this->value = new digit[1];this->reserve(-1);}void bigInt::reserve(ull new_cap = -1) {if (new_cap == -1) new_cap = (this->capacity) << 1;digit *past_value = this->value;this->capacity = new_cap;this->value = new digit[this->capacity];for (int idx = 0; idx < (this->length); ++idx) value[idx] = past_value[idx];for (int idx = (this->length); idx < new_cap; ++idx) { value[idx] = 0; }delete[] past_value;}inline void bigInt::put_string(std::string from) {this->Genshin_Impact_start();if (from.front() == '-') {sign = 1;from = from.substr(1);}for (const char &to_put : from) {this->emplace_back(to_put ^ 48);}for (int l = 0, r = this->length - 1; l < r; ++l, --r) std::swap(value[l], value[r]);this->pop_zero();}inline void bigInt::put_bigInt(const bigInt &from) {this->Genshin_Impact_start();for (int idx = 0; idx < from.length; ++idx) this->emplace_back(from.value[idx]);this->sign = from.sign;}inline void bigInt::put_ull_interger(ull from, const bool &new_sign) {this->Genshin_Impact_start();this->sign = new_sign;while (from) {this->emplace_back(from % 10);from /= 10;}this->pop_zero();}inline void bigInt::put_ll_interger(const ll &from) {if (from < 0) this->put_ull_interger((ull)-from, 1);else this->put_ull_interger(from, 0);}inline void bigInt::emplace_back(const digit &new_digit) {if ((this->length) == (this->capacity)) this->reserve();this->value[(this->length)++] = new_digit;}inline void bigInt::pop_zero() {while (length && this->value[length - 1] == 0) {--length;if (length == (capacity >> 1)) reserve(capacity >> 1);}}inline void bigInt::negation() { this->sign = !(this->sign); }inline digit bigInt::at(const int &idx) const {if (idx < length) return value[idx];else return 0;}bigInt &bigInt::operator=(const bigInt &from) { this->put_bigInt(from); return *this; }bigInt &bigInt::operator=(std::string from) { this->put_string(from); return *this; }bigInt &bigInt::operator=(const ull &from) { put_ull_interger(from, 0); return *this; }bigInt &bigInt::operator=(const ll &from) { put_ll_interger(from); return *this; }bigInt &bigInt::operator=(const unsigned int &from) { put_ull_interger(from, 0); return *this; }bigInt &bigInt::operator=(const int &from) { put_ll_interger(from); return *this; }inline ull bigInt::size() { return this->length; }inline ll bigInt::to_digit() {ll ans = 0, weight = 1;for (int i = 0; i < length; ++i) {ans += value[i] * weight;weight *= 10;}return (sign ? (-ans) : ans);}inline std::string bigInt::to_string() {std::string ans;if (sign) ans.push_back('-');for (int i = length - 1; i >= 0; --i) ans.push_back(value[i] + '0');return ans;}inline bool bigInt::operator==(const bigInt &other) const {if (this->length != other.length || this->sign != other.sign) return false;for (int idx = 0; idx < (this->length); ++idx) {if (this->value[idx] != other.value[idx]) return false;}return true;}inline bool bigInt::operator<(const bigInt &other) const {if (this->sign == 1 && other.sign == 0) return true;else if (this->sign == 0 && other.sign == 1) return false;else if (this->sign == 1 && other.sign == 1) return -(*this) > -other;if (this->length < other.length) return true;if (this->length > other.length) return false;for (int idx = (this->length) - 1; idx >= 0; --idx) {if (this->value[idx] > other.value[idx]) return false;if (this->value[idx] < other.value[idx]) return true;}return false;}inline bool bigInt::operator>(const bigInt &other) const {if (this->sign == 1 && other.sign == 0) return false;else if (this->sign == 0 && other.sign == 1) return true;else if (this->sign == 1 && other.sign == 1) return -(*this) < -other;if (this->length > other.length) return true;else if (this->length < other.length) return false;for (int idx = (this->length) - 1; idx >= 0; --idx) {if (this->value[idx] < other.value[idx]) return false;if (this->value[idx] > other.value[idx]) return true;}return false;}inline bool bigInt::operator<=(const bigInt &other) const { return !((*this) > other); }inline bool bigInt::operator>=(const bigInt &other) const { return !((*this) < other); }inline bool bigInt::operator!=(const bigInt &other) const { return !((*this) == other); }inline bigInt bigInt::operator<<(const int &num) {bigInt ans;ans.reserve(length + num);ans.length = ans.capacity;for (int i = 0; i < num; ++i) ans.value[i] = 0;for (int i = 0; i < length; ++i) ans.value[i + num] = value[i];ans.pop_zero();return ans;}inline bigInt bigInt::operator>>(const int &num) {if ((this->length) <= num) return bigInt();bigInt ans;ans.reserve(length - num);ans.length = ans.capacity;for (int i = num; i < length; ++i) ans.value[i - num] = value[i];ans.pop_zero();return ans;}inline bigInt bigInt::operator-() const {bigInt ans = (*this);ans.negation();return ans;}inline bigInt bigInt::operator+(bigInt other) {if (this->sign != other.sign) {if (this->sign == 1) {if (-(*this) > other) return -(-(*this) - other);else return other - (-(*this));}else if (this->sign == 0) {if ((*this) > -other) return (*this) - (-other);else return -(-other - (*this));}}if (other == 0) return (*this);bigInt ans;ans.reserve(std::max(other.length, this->length) + 1);ans.length = ans.capacity;for (int idx = 0; idx < ans.length; ++idx) {ans.value[idx] += this->at(idx) + other.at(idx);if (ans.value[idx] >= 10) {++ans.value[idx + 1];ans.value[idx] -= 10;}}ans.pop_zero();ans.sign = this->sign;return ans;}inline bigInt bigInt::operator-(bigInt other) {if (this->sign || other.sign) {if (this->sign == 0 && other.sign == 1) return (*this) + (-other);if (this->sign == 1) {if (other.sign == 0) {return -(-(*this) + other);}else {return (*this) + (-other);}}}if (other == 0) return (*this);if ((*this) < other) return -(other - (*this));bigInt ans;ans.reserve(this->length);ans.length = ans.capacity;for (int idx = 0; idx < (this->length); ++idx) {ans.value[idx] += this->at(idx) - other.at(idx);if (ans.value[idx] < 0) {--ans.value[idx + 1];ans.value[idx] += 10;}}return ans;}inline bigInt bigInt::operator*(bigInt other) {bigInt ans;int now;ans.reserve(this->length + other.length);ans.length = ans.capacity;for (int idx_this = 0; idx_this < (this->length); ++idx_this) {for (int idx_other = 0; idx_other < other.length; ++idx_other) {now = idx_this + idx_other;ans.value[now] += (this->at(idx_this)) * other.at(idx_other);if (ans.value[now] >= 10) {ans.value[now + 1] += (ans.value[now]) / 10;ans.value[now] %= 10;}}}ans.pop_zero();ans.sign = (this->sign) != other.sign;return ans;}inline bigInt bigInt::operator/(bigInt other) {if (other == bigInt(0)) {std::cerr << "Error: Divide by zero!" << std::endl;throw std::invalid_argument("Divide by zero!");}else if ((*this) == bigInt(0)) return 0;else if ((*this) < other) return 0;bigInt ans, cur, divi = (*this);int l, r, mid;ans.reserve((this->length) - other.length + 1);ans.length = ans.capacity;for (int idx = ans.length - 1; idx >= 0; --idx) {cur = divi >> idx;l = 0, r = 9;while (l < r) {mid = l + r + 1 >> 1;if (other * mid <= cur) l = mid;else r = mid - 1;}mid = l;ans.value[idx] = l;divi = divi - ((other * mid) << idx);divi.pop_zero();}ans.pop_zero();ans.sign = (this->sign) != other.sign;return ans;}inline bigInt bigInt::operator%(bigInt other) {if (other == bigInt(0)) {std::cerr << "Error: Divide by zero!" << std::endl;throw std::invalid_argument("Divide by zero!");}else if ((*this) == bigInt(0)) return 0;bigInt cur, divi = (*this);int l, r, mid;for (int idx = ((this->length) - other.length); idx >= 0; --idx) {cur = divi >> idx;l = 0, r = 9;while (l < r) {mid = l + r + 1 >> 1;if (other * mid <= cur) l = mid;else r = mid - 1;}mid = l;divi = divi - (other * mid << idx);divi.pop_zero();}return divi;}inline bigInt &bigInt::operator<<=(const int &num) { return ((*this) = (*this) << num); }inline bigInt &bigInt::operator>>=(const int &num) { return ((*this) = (*this) >> num); }inline bigInt &bigInt::operator+=(const bigInt &num) { return ((*this) = (*this) + num); }inline bigInt &bigInt::operator-=(const bigInt &num) { return ((*this) = (*this) - num); }inline bigInt &bigInt::operator*=(const bigInt &num) { return ((*this) = (*this) * num); }inline bigInt &bigInt::operator/=(const bigInt &num) { return ((*this) = (*this) / num); }inline bigInt &bigInt::operator%=(const bigInt &num) { return ((*this) = (*this) % num); }inline bigInt bigInt::operator&(bigInt other) {bigInt ans;ans.reserve(std::max(this->length, other.length));ans.length = ans.capacity;for (int i = 0; i < ans.length; ++i) {ans.value[i] = this->at(i) & other.at(i);}ans.pop_zero();ans.sign = this->sign & other.sign;return ans;}inline bigInt bigInt::operator|(bigInt other) {bigInt ans;ans.reserve(std::max(this->length, other.length));ans.length = ans.capacity;for (int i = 0; i < ans.length; ++i) {ans.value[i] = this->at(i) | other.at(i);}ans.pop_zero();ans.sign = this->sign | other.sign;return ans;}inline bigInt &bigInt::operator&=(const bigInt &other) {return (*this = *this & other);}inline bigInt &bigInt::operator|=(const bigInt &other) {return (*this = *this | other);}bigInt& bigInt::operator++() {*this += bigInt(1);return *this;}bigInt bigInt::operator++(int) {bigInt temp = *this;++(*this);return temp;}bigInt& bigInt::operator--() {*this -= bigInt(1);return *this;}bigInt bigInt::operator--(int) {bigInt temp = *this;--(*this);return temp;}
}using namespace BigINT;
#define int bigInt
struct node{
int z,y;
}a[1001];
bool cmp(node a,node b){
return a.z<b.z;
}
int n,a1,b1;
int sum[1001],ma=-100;
signed main(){
cin>>n>>a1>>b1;
for(signed i=1;i<=n;i+=1) cin>>a[i].z>>a[i].y;
sort(a+1,a+n+1,cmp);
sum[0]=a1;
for(signed i=1;i<=n;i+=1){
sum[i]=sum[i-1]*a[i].z;
ma=max((sum[i-1]/a[i].y),ma);
}
cout<<ma;
}