Codeforces 260 A - A. Laptops】的更多相关文章

题目链接:http://codeforces.com/contest/456/problem/A 解题报告:有n种电脑,给出每台电脑的价格和质量,要你判断出有没有一种电脑的价格小于另一种电脑但质量却大于另一台电脑的情况. 把输入排个序就可以了,但是我比赛的时候排序只是按照价格排序了,锁定代码之后发现了这个错误,但已经改不了了,但是最后居然AC了,说明CF的数据也是有问题的. #include<cstdio> #include<cstring> #include<iostrea…
[codeforces 260]B. Ancient Prophesy 试题描述 A recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is a string that only consists of digits and characters "-". We'll say that some date is mentioned in the P…
题目链接:http://codeforces.com/contest/456/problem/C 解题报告:给出一个序列,然后选择其中的一个数 k 删除,删除的同时要把k - 1和k + 1也删除掉,同时总分数里面加上一个k,求最大的分数可以是多少? dp题,递推公式是  dp[i] = max(dp[i-2]+num[i] * i,dp[i-1]);  ,注意要用long long ,一开始没用WA了两发. #include<cstdio> #include<cstring> #…
题目链接:http://codeforces.com/contest/456/problem/B 解题报告:输入一个n,让你判断(1n + 2n + 3n + 4n) mod 5的结果是多少?注意n的范围很大很大 n (0 ≤ n ≤ 10105). 只要判断是否能被整除4就可以了,如果n能被4整除,则结果是4,如果不能,则结果是0 但n很长,不能直接mod,但只要判断最低的两位能不能被4整除就可以了,如果n只有一位就判断最低的一位. #include<cstdio> #include<…
题目地址:http://codeforces.com/contest/456/problem/C 脑残了. .DP仅仅DP到了n. . 应该DP到10w+的. . 代码例如以下: #include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <cty…
C题就是个dp,把原数据排序去重之后得到新序列,设dp[i]表示在前i个数中取得最大分数,那么: if(a[i] != a[i-1]+1)   dp[i] = cnt[a[i]]*a[i] + dp[i-1]; else      dp[i] = dp[i] = max(dp[i-1],a[i]*cnt[a[i]] + dp[i-2]),    dp[i-1]表示不取a[i], a[i]*cnt[a[i]] + dp[i-2]表示取a[i]. cnt[a[i]]是a[i]出现的次数. #incl…
打表发现规律,对4取模为0的结果为4,否则为0,因此只需要判断输入的数据是不是被4整出即可,数据最大可能是100000位的整数,判断能否被4整出不能直接去判断,只需要判断最后两位(如果有)或一位能否被4整出即可. #include<map> #include<cmath> #include<queue> #include<cstdio> #include<string> #include<vector> #include<cst…
A:水的问题.排序结构.看看是否相同两个数组序列. B:他们写出来1,2,3,4,的n钍对5余.你会发现和5环节. 假设%4 = 0,输出4,否则输出0. 写一个大数取余就过了. B. Fedya and Maths time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Fedya studies in a gymnasium. Fe…
A. Laptops time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the…
http://codeforces.com/contest/456/problem/A A. Laptops time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One day Dima and Alex had an argument about the price and quality of laptops. Dima thi…