目录
D - Iroha and Haiku (New ABC Edition)
A - Apple
A - Apple
https://atcoder.jp/contests/abc265/tasks/abc265_a
题目描述
高桥去买苹果,已知买一个苹果需x元,买三个苹果需y元,问你买n个苹果至少需要多少钱
题目分析
这道题只需分类讨论,选择最优策略即可
题目代码
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/(gcd(a,b))*b;}
int x,y,n;
int main(){
cin>>x>>y>>n;
if(3*x>y){
cout<<n/3*y+n%3*x<<endl;
}
else{
cout<<n*x<<endl;
}
return 0;
}
//ACplease!!!
B - Explore
B - Explore
https://atcoder.jp/contests/abc265/tasks/abc265_b
题目描述
有n个房间排成一列,起初高桥在第一个房间,且时间限额为t单位时间,从第i个房间到下一个房间需
单位时间。在这些房间内,共有m个奖励,每个奖励是在到达特定房间后获得若干单位时间限额。剩余时间限额在任何时刻都必须大于0单位时间。问你能否顺利到达最后一个房间
题目分析
这道题只需要根据题目要求进行模拟即可,并不需要太多编程基础
题目代码
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int l

最低0.47元/天 解锁文章
2328

被折叠的 条评论
为什么被折叠?



