Alyona and copybooks】的更多相关文章

A. Alyona and copybooks Problem Description: Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs…
A. Alyona and copybooks time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have eq…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each…
题目连接 题意: 给 n,a,b,c四个数,n为已有的书的数目,问再买k本书所需花费最少是多少,(k+n)%4==0: 有三种套餐 第一种只有一本书,花费a 第二种有两本书,花费b, 第三种有三本书,花费c. 暴力,n,k只有四种情况:n=0,k=0;   n=1,k=3;    n=2,k=2;    n=3,k=1; n=0时,不用买: n=1时,有三种买法可以可能出现最优解:3*a;    a+b;   c; n=2时,有三种买法可以可能出现最优解: 2*a;  b;   2*c; n=3…
这题考查思维的全面性. 一开始我直接分类推公式,余数不同分类讨论. AC代码: #include<cstdio> #include<algorithm> using namespace std; typedef long long LL; const LL inf=1e12; int main(){ LL ans=inf; LL n,a,b,c; scanf("%lld%lld%lld%lld",&n,&a,&b,&c); int…
完全背包. 直接做个背包容量为$100000$的完全背包,这样就可以避免繁琐的分类讨论了. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #include<map> #incl…
A. Alyona and copybooks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal…
刷了这套题  感触良多 我想 感觉上的差一点就是差很多吧 . 每次都差一点  就是差很多了... 不能气馁..要更加努力去填补那一点点.  老天不是在造物弄人,而是希望你用更好的自己去迎接自己. A. Alyona and copybooks 有n本书  还需要买k本使得(n+k)%4==0 有三种  一本 a元  两本 b元  三本 c元的 不能分开卖 问至少花多少 枚举一下即可  ... 我居然一开始搞了个dp记录买1-4本的最优策略....还wa了.... #include <stdio.…
A.Alyona and copybooks Problems: 给你一个数n和代价分别为a, b, c.数量不限的1, 2, 3,求将n凑成4的倍数的最小代价 Analysis: cj:取个模随便凑一凑就好 Tags: Implementation #define PRON "pa" #include <cstdio> #include <cstring> #include <iostream> #include <algorithm>…
D. Alyona and a tree Problem Description: Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positive integer, in the vertex i she wrote ai. Moreover, the girl wrote a positive integer to every edg…