码迷,mamicode.com
首页 > 其他好文 > 详细

[CF1065A]Vasya and Chocolate

时间:2018-10-18 22:09:01      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:class   \n   div   题解   ola   long   str   style   ++   

题目大意:有$s$元,一个物品$c$元,每买$a$个就送$b$个,问一共可以买多少。

题解:全部买好,最后看可以送多少(其实是因为我这道题交错了,无聊才做的)

卡点:

 

C++ Code:

#include <cstdio>
int Tim;
int main() {
	scanf("%d", &Tim);
	while (Tim --> 0) {
		long long s, a, b, c;
		scanf("%lld%lld%lld%lld", &s, &a, &b, &c);
		long long tmp = s / c;
		tmp += tmp / a * b;
		printf("%lld\n", tmp);
	}
	return 0;
}

  

[CF1065A]Vasya and Chocolate

标签:class   \n   div   题解   ola   long   str   style   ++   

原文地址:https://www.cnblogs.com/Memory-of-winter/p/9812957.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!