题目地址是:ac.nowcoder.com/acm/contest…
总的来说 这是一道没什么思考量的题目 但是我想说 要注意的是题目的数据范围
10^18爆int了 要开LL
不仅仅是那个数组要开LL
ans = U[i] / q[i] 也有可能爆int 所以都要一起开了
下面是代码
#include <iostream>
#include <cstring>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 1e5+5;
typedef long long LL;
LL q[N], u[N];
int main()
{
LL t;
cin >> t;
while ( t -- )
{
memset(q, 0, sizeof(q));
memset(u, 0, sizeof(u));
LL n, sum = 0, ans = INF;
//初始化
cin >> n;
for(int i = 0; i < n; i++) cin >> q[i];
for(int i = 0; i < n; i++)
{
cin >> u[i];
sum = u[i] / q[i];
if( sum < ans ) ans = sum;
}
cout << ans << endl;
}
return 0;
}