I. 吃鸡腿
Problem ID: 9217
Contest ID: 5697
必做题
时间:0.2 空间:32M
题目描述:
小A最喜欢吃鸡腿了。现在,炸鸡腿买三送一了!每只鸡腿a元,小A手中有B元。问小A能吃到多少只鸡腿?
输入格式:
一行两个整数a,B。
输出格式:
一行一个整数,表示答案。
样例输入:
1 7
样例输出:
9
Problem ID: 9217
Contest ID: 5697
必做题
时间:0.2 空间:32M
题目描述:
小A最喜欢吃鸡腿了。现在,炸鸡腿买三送一了!每只鸡腿a元,小A手中有B元。问小A能吃到多少只鸡腿?
输入格式:
一行两个整数a,B。
输出格式:
一行一个整数,表示答案。
样例输入:
1 7
样例输出:
9
这是代码
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b;
if(b%a==0){
c=printf(“%.0lf”,(b/a)/3);
cout<<b/a+c;
}
else if(b%a!=0){
c=printf(“%.0lf”,(b/a)/3);
printf(“%。0lf”,(b/a)+c);
}
return 0;
}
我觉得自己的代码有点荒唐
样例输出是-19
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
if(b/a>=3){
cout<<b/a+b/a/3;
}else{
cout<<b/a;
}
return 0;
}
简单的题目不要想复杂好不好
有用的话给个解决方案
不应该先到先得吗
看楼主的想法咯
他想给谁就给谁
他好像人不在
你没给思路(ˉ▽ˉ;)…
e 你牛
不当言论举报了(⊙﹏⊙)
我删了
不小心在你删之前举报了
e e e e
无语ing
其实还有更简单的
#include<bits/stdc++.h>
using namespace std;
int a,b,ans=0;
int main(){
cin>>a>>b;
ans += b/a;//一开始可以买的个数
ans += ans/3;//买三送一
cout<<ans;
return 0;
}
给本蒟蒻一个解撅方案吧(诚恳