第一题 10A
题意:电脑有三种模式,正常模式每分钟耗电p1,如果没有使用电脑t1分钟后变成第二种模式每分钟耗电p2,如果还是没有使用电脑t2分钟后变成第三种模式每分钟耗电p3。给定n个区间,每一个区间是正常模式,每个区间的间隔是没有使用,问总的耗电是多少
思路:直接暴力枚举
代码:
# input
list = raw_input().split()
n,p1,p2,t1,t2,t3 = map(int , list)
# solve
ans = 0
pre = -1
while n > 0:
n -= 1
list = raw_input().split()
start,end = map(int , list)
ans += (end-start)*p1
if pre != -1:
x = start-pre
if x > t1:
ans += t1*p1
x -= t1
if x > t2:
ans += t2*p2
x -= t2
ans += x*p3
else:
ans += x*p2
else:
ans += x*p1
pre = end
print ans
第二题 11A
A sequencea0, a1, ..., at - 1is
called increasing ifai - 1 < aifor
eachi: 0 < i < t.
You are given a sequenceb0, b1, ..., bn - 1and
a positive integerd. In each move you may choose one element of the given sequence and adddto
it. What is the least number of moves required to make the given sequence increasing?
Output
Output the minimal number of moves needed to make the sequence increasing.
题意:给定n个数的序列,现在要把这个序列变成递增的序列,满足ai < ai+1,现在规定每次可以选择一个数来增加d,问最少需要几次
思路:枚举每一个数求个数即可
代码:
# input
n,d = map(int , raw_input().split())
list = map(int , raw_input().split())
# getAns
ans = 0
for i in range(1,len(list)):
if list[i] <= list[i-1]:
x = (list[i-1]-list[i])/d+1
list[i] += x*d
ans += x
print ans
第三题 12A
There is a very secret base in Potatoland where potato mash is made according to a special recipe. The neighbours from Porridgia decided to seize this recipe and to sell it to Pilauland. For this mission they have been preparing special agent Pearlo for many
years. When, finally, Pearlo learned all secrets of espionage, he penetrated into the Potatoland territory and reached the secret base.
Now he is standing at the entrance, but to get inside he need to pass combination lock. Minute ago one of the workers entered the password on the terminal and opened the door. The terminal is a square digital keyboard3 × 3with
digits from1to9.
Pearlo knows that the password consists from distinct digits and is probably symmetric with respect to the central button of the terminal. He has heat sensor which allowed him to detect the digits which the worker pressed. Now he wants to check whether the
password entered by the worker is symmetric with respect to the central button of the terminal. This fact can Help Pearlo to reduce the number of different possible password combinations.
Output
PrintYESif the password is symmetric with respect to the central button of the terminal andNOotherwise.
Note
If you are not familiar with the term «central symmetry», you may look into http://en.wikipedia.org/wiki/Central_symmetry
题意:给定一个3*3的矩形,每个元素不是X就是.,问这个矩形是否是对称的
思路:暴力枚举每一个点,然后判断每个点是否和它的对称点都相等即可
代码:
# input
matrix = []
for i in range(3):
matrix.append(raw_input())
# solve
def isOk():
for i in range(3):
for j in range(3):
x = 2-i
y = 2-j
if matrix[i][j] != matrix[x][y]:
return False
return True
# ouput
if isOk():
print "YES"
else:
print "NO"
分享到:
相关推荐
在python和bash中使用简单的解析和检查实现,以解决Codeforce中的竞赛。\ 安装 git clone " https://github.com/siddharth17196/codeforces-cli.git " cd codeforces-cli/scripts bash install.sh 将以下内容添加...
Codeforces-Round-492-:解决问题shorturl.atetAIW
codeforces-scraper:刮除来自codeforces的解决方案
:exploding_head: :exploding_head: :female_sign: 我准备链接问题和解决方案 :person_raising_hand: :female_sign: 您已克隆并尝试以下操作:使用Python代码,必须先下载python然后再运行它 :star: :female_sign: ...
codeforces-crawler 一个建议问题,进行虚拟竞赛并为编码平台codeforce的用户显示用户统计信息的网站。 网站链接: 要求 安装要求 导航到目录并运行 点安装-r requirements.txt 运行项目 导航到目录并运行 python ...
CodeForces 适用于问题的Python解决方案。 用户名: hopper19
Codeforces解决方案
单击问题名称以访问Codeforces上的原始问题页面,进行解决,然后返回此处并重复。 祝你好运,高评价! 链接到已部署的应用程序 链接到Codeforces博客 注意 随时提出有关错误/改进的问题。 如果对存储库有任何帮助...
Codeforces解决方案该存储库包含我在codeforces.com上提交并接受的各种问题的解决方案。
Python竞争性编程解决方案 此仓库由My Python解决方案组成,用于解决LeetCode,HackerEarth,GeeksforGeeks,Codechef等各种问题。 解决方案将定期更新。
Codeforces问题解决方案
codeforces解决方案个人资料链接
Codeforces - 比赛于凌晨 12.30 开始 635 Div 2 (16-04-2020) - 排名 11707/21686 参与者 637 Div 2 (24-04-2020) - 排名 12511/23207 参与者 638 Div 2 (02-05-2020) - 排名 9926/24059 参与者 639 Div 2 未评级 ...
Codeforces_Problemset_Solution Codeforces问题的解决方案将在这里上传。 我将尝试使用C ++解决大多数问题。
cp工具 cp-tool是一个自动生成器,用于解决不同在线法官的问题。 它收集了在线法官解决的所有问题,并为... cp-tool -c init -j codeforces 您会被要求 处理 例如: shifat57 存储库名称(将根据存储库名称创建一个文
如果解决方案已经存在,则将不会合并。 遵循命名约定。 例如:107D。 问题的名称.cpp 我在编码时经常忘记的事情: 使用lambda在python3中排序: 假设x是一个元组,并且排序将取决于x [0],如果x [0]相等,则x [1]...
力编码器 无需打开网站即可解决 CodeForces Round 问题! 文档和使用方法即将推出
跟踪您的竞争对手一个命令行实用程序,可以在Spoj,Codechef,Codeforces等各种在线法官上跟踪您的竞争对手。 想要查看您在Codechef上的朋友状态,或想要解决竞争对手在SPOJ上遇到的所有问题。 尝试跟踪您的竞争对手...
这种工具可以自动从codeforces找到高质量的Python解决的任务。 我写这个工具是为了帮助我找到好的资源来提高我的 Python 技能。 cd codeforces python solution-finder.py (number of the contest, e.g. 988) ...
解决 CodeForces 问题