Codeforces Round #131 (Div. 2)
A. System of Equations
- \(a\)的范围在\(\sqrt n\)内,所以暴力枚举即可。
B. Hometask
- 需要被2、5整除,所以末位必然为0,如果0没有出现,则直接返回-1。
- 在不考虑被3整除的情况下,为了凑出最大数,必然是从9到0的顺序填数。
- 设位数和模3的值为\(sum\),如果\(sum=0\),显然当前数即答案,否则考虑去除一些数使得数被3整除。
- 因为\(sum \ne 0\),所以\(sum=1\ or\ sum = 2\),显然去除的数不会超过2个。优先考虑去除一个数\(x\),需要满足\(x \% 3 = sum\),且越小越好;去除两个数时\((x, y)\),需要满足\((x+y)\%3=sum\),且两个值越小越好。
C. Game
- 游戏顺序必然是\(\cdots \to 1 \to 2 \to 3 \to 1 \to \cdots\)
- 那么只要枚举起点,取最小值即可。
D. Numbers
- \(f(i,j)\)表示由前i个数凑成长度为j的方案数。
- 每次转移时,当前数的个数需要大于等于\(a[i]\)。
- 由于不能有前导0,所以填0时需要去掉首位这个位置。
E. Relay Race
- \(dp(i,j,k)\)表示走了i步后,第一个人的横坐标为j,第二个人为k的最大值。
- 转移时需要判断两个人是否在同一格子,即\(j==k\)。
Codeforces Round #131 (Div. 2)的更多相关文章
- Codeforces Round #131 (Div. 1) B. Numbers dp
题目链接: http://codeforces.com/problemset/problem/213/B B. Numbers time limit per test 2 secondsmemory ...
- Codeforces Round #131 (Div. 2) B. Hometask dp
题目链接: http://codeforces.com/problemset/problem/214/B Hometask time limit per test:2 secondsmemory li ...
- Codeforces Round #131 (Div. 2) E. Relay Race dp
题目链接: http://codeforces.com/problemset/problem/214/E Relay Race time limit per test4 secondsmemory l ...
- Codeforces Round #131 (Div. 2) : B
首先能被2,5整除的数结尾必须是0: 如果没有0肯定不行: 然后判断他们的和ans%3: 如果==0,直接从大到小输出就行: 如果==1,要么删除它们之间最小的那个%3==1的,要么删除两个小的并且% ...
- Codeforces Round #131 (Div. 1) A - Game
A. Game time limit per test 1 second memory limit per test 256 megabytes input standard input output ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
随机推荐
- 使用AWT组件实现验证码功能
import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics2D ...
- 解决json跨域时错误:SyntaxError: invalid label
将数据做以下返回: $callback = $_GET['callback']; echo $callback.'('.json_encode(array('html'=>$html)).')' ...
- PAT 10-2 删除字符串中的子串
今天发一个不完全对(通过garbageMan园友的帮忙,现已全对)的代码,(/*后两用例未通过,一时看不出问题在哪,*/)切入正题 /* Name: Copyright: Author: Date: ...
- acedGetString获取用户输入字符串
acedGetString()[ads_getstring()]int acedGetString(int cronly, const TCHAR *prompt, TCHAR *psz) acedG ...
- 对NSNumber的理解
1.nsnumber最重要的作用是可以封装任何的值对象,就是说nsnumber对象的类型可以是任何的类型. 如nsnumber *number = @"12" nsnumber * ...
- python3爬虫再探之豆瓣影评数据抓取
一个关于豆瓣影评的爬虫,涉及:模拟登陆,翻页抓取.直接上代码: import re import time import requests import xlsxwriter from bs4 imp ...
- HDOJ-三部曲一(搜索、数学)-1002-Children of the Candy Corn
Children of the Candy Corn Time Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Jav ...
- 10年山东省赛-E-最短路
题目连接:http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=2155&cid=1430 题意:输入一个n个节点,m条边的图,然后k条记录,纪录 ...
- Connection to DB
Connect to MySQL PHP5 and later can work with a MySQL database using MySQLi extension PDO PDO will w ...
- 手机端APP原型相关
http://www.isux.us/demoo/index.php(很慢) https://www.mockplus.cn/