【codeforces 808】C.Tea Party(贪心)

题目链接:http://codeforces.com/contest/808/problem/C解题思路:应该算贪心的思想吧,首先给每个杯子倒茶(a[i]+1)/2毫升,如果茶壶水不够,输出-1. 否则,把当前茶壶剩下水,倒给其他水杯中,从容量最大的开始,直接倒满,如果还有剩余,就给第二大的水杯...

2017-05-16 22:27:19

阅读数:356

评论数:0

【Codeforces 805】D. Minimum number of steps

题目链接:http://codeforces.com/contest/805/problem/D思路:从左到右进行遍历,当遇到b的时候,计算前面有多少个a, 然后求出转换从str[0]到这个位置的子字符串变化需要次数,是2^numA-1次, 写出下面代码,结果TLE。#include <...

2017-05-07 17:37:57

阅读数:158

评论数:0

[Codeforces805] C. Find Amir

题目链接:http://codeforces.com/contest/805/problem/C思路: 头尾相加就等于n+1,花费最少的遍历顺序就是1->n->2->(n-1)->3->(n-2)…… 可以发现结果就是 (n-1)/2#include <io...

2017-05-07 17:23:20

阅读数:170

评论数:0

Codeforces Round #407 (Div. 2) C. Functions again

题目链接:http://codeforces.com/contest/789/problem/C题目就是求最大连续子序列,但是从起点开始,数字都是一正一负, 需要可以分成奇数位和偶数位开始 两种情况。 这里还需要注意的是用int64,不然会爆掉。#include <stdio.h>...

2017-03-30 22:50:45

阅读数:130

评论数:0

D. Number of Parallelograms

time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output You are given n points on a pl...

2016-04-09 23:55:06

阅读数:288

评论数:0

C. Hard Process

You are given an array a with n elements. Each element of a is either 0 or 1. Let's denote the length of the longest subsegment of consecutive elem...

2016-04-09 22:44:44

阅读数:360

评论数:0

B. Seating On Bus

Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people....

2016-04-09 19:22:30

阅读数:150

评论数:0

Kolya and Tandem Repeat

Kolya and Tandem Repeat time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standar...

2014-06-21 01:23:11

阅读数:1487

评论数:0

Valera and Tubes

C. Valera and Tubes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard out...

2014-06-20 00:02:41

阅读数:1314

评论数:0

Valera and Fruits

B. Valera and Fruits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard ou...

2014-06-19 22:17:00

阅读数:744

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭