Codeforces 415B Mashmokh and Tokens(贪心)
来源:互联网 发布:python中的iter 编辑:程序博客网 时间:2024/06/06 16:36
题目链接:Codeforces 415B Mashmokh and Tokens
题目大意:给出w,a,b,表示说有w天,每天给有x个令牌,然后根据公式可以将令牌换成钱,但是有可能1个令牌和两个令牌换到的钱数相同,那么久没有必要多花令牌,所以问说每一天最多节省多少令牌,在换取钱最多的情况。
解题思路:(x * a % b)/ a.
#include <stdio.h>#include <string.h>#include <iostream>using namespace std;const int N =1e5+5;typedef long long ll;int main () {ll n, a, b, c, w, ans[N];cin >> n >> a >> b;for (int i = 1; i <= n; i++) {cin >> w;ans[i] = (w * a % b)/a;}for (int i = 1; i < n; i++)cout << ans[i] << " ";cout << ans[n] << endl;return 0;}
0 0
- Codeforces 415B Mashmokh and Tokens(贪心)
- codeforces 415B Mashmokh and Tokens
- CodeForces 415B Mashmokh and Tokens
- codeforces 415B Mashmokh and Tokens
- 415B - Mashmokh and Tokens
- codeforces Mashmokh and Tokens
- B - Mashmokh and Tokens
- Codeforces Round #240 (Div. 2)B. Mashmokh and Tokens
- codeforces#240_div2_B Mashmokh and Tokens
- cf——B. Mashmokh and Tokens
- CodeForces 414B Mashmokh and ACM (DP)
- Codeforces 414B Mashmokh and ACM(DP)
- CodeForces 414B--Mashmokh and ACM (dp)
- Mashmokh and ACM - CodeForces 414B dp
- codeforces 414B Mashmokh and ACM
- codeforces--414B--Mashmokh and ACM
- codeforces-414B-Mashmokh and ACM
- Codeforces 414b Mashmokh and ACM
- Android-4.2.2之ActionBar(一)------Menu键的显示
- Google Code Jam 2014 A. Magic Trick
- 斯坦福大学-线性回归_Exercise Code
- 维基 OJ 1010 过河卒
- linux nginx svn 安装
- Codeforces 415B Mashmokh and Tokens(贪心)
- 前端开发Javascript智能感知(Intellisense)
- linux下svn常用指令
- Oracle Dedicated server 和 Shared server(专用模式 和 共享模式) 说明
- 持之以恒的学习心态才是真正学会互联网网站制作技能的上策
- openwrt使用sdk编译应用程序
- Java设计模式的六大原则
- hdu 1060 Leftmost Digit
- 如果选择合适的资源