首页 > 牛牛去购物
头像 asfhoiadf
发表于 2023-01-06 22:32:30
A A simple question. We can use a for loop to enumerate the number of basketballs we choose to buy, and then calculate the number of soccer balls we b 展开全文
头像 zhangas
发表于 2023-01-06 21:32:00
T1 给哥们卡住了 上来交了发 int c=a+b; cout<<min(n%c-a,n%c-b); 额仔细一想这样不一定对 不一定是尽可能配套选择 然后开始枚举 过了 int ans=n; for(int i=0;i*a<n;i++){ ans=min(ans,(n-i* 展开全文
头像 奕羿
发表于 2023-08-07 09:12:25
这题由于数据不大,简答枚举一下 #include<bits/stdc++.h> using namespace std; int main(){ int n,x,y; cin>>n>>x>>y; int t; t=n/x 展开全文
头像 CARLJOSEPHLEE
发表于 2024-10-28 12:58:47
利用最大公倍数和最小公因数来减小枚举空间 from math import gcd n,a,b = map(int,input().split()) c = gcd(a,b) d = a*b//c l = set() for i in range(b//c): for j in range( 展开全文

等你来战

查看全部