CodeForces 610A Pasha and Stick】的更多相关文章

#include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; int n,ans; int main() { while(~scanf("%d",&n)){ ans=; !=)ans=; -)/; printf("%d\n",ans); } ; }…
A. Pasha and Stick 题目连接: http://www.codeforces.com/contest/610/problem/A Description Pasha has a wooden stick of some positive integer length n. He wants to perform exactly three cuts to get four parts of the stick. Each part must have some positive…
A. Pasha and Stick   Pasha has a wooden stick of some positive integer length n. He wants to perform exactly three cuts to get four parts of the stick. Each part must have some positive integer length and the sum of these lengths will obviously be n.…
题目链接:http://codeforces.com/problemset/problem/557/B 题目意思:有 2n 个茶杯,规定第 i 个茶杯最多只能装 ai 毫升的水.现在给出 w 毫升的水,需要把这 w 毫升(可以不用光)的水倒入到这 2n 个茶杯中,使得分给 n 个男的每个水杯的水恰好是 n 个女的2倍(注意,n 个男的水杯装的水是一样的,n 个女也是).现在问的是,怎样使得 2n 个杯装的水最多,求出这个值. ***********************************…
简单贪心.... B. Pasha Maximizes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has a positive integer a without leading zeroes. Today he decided that the number is too small and he shoul…
595B - Pasha and Phone 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back ; const int INF=0x3f3f3f3f; ; ll a[N]; int b[N]; ]={}; int main() { ios::sync_with_stdio(false); cin.tie(); int n,k; cin>>n>&g…
B. Pasha and Phone time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has recently bought a new phone jPager and started adding his friends' phone numbers there. Each phone number consis…
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string. Pasha didn't like his present…
题意:给定一个长度为len的字符序列,然后是n个整数,对于每一个整数ai, 将字符序列区间为[ai,len-ai+1]进行反转.求出经过n次反转之后的序列! /* 思路1:将区间为偶数次的直接去掉!对剩下的区间进行反转.超时了,智商上的压制... */ #include<iostream> #include<cstdio> #include<algorithm> #include<stack> #include<cstring> #include…
题意就是一次次翻转字符串 然后输出最终的字符串 暴力一发O(n*m)果然超时了 因为每次翻转的的都是a-1到对称位置 所以一个位置翻转两次等于没有操作 所以只需要记录一下len/2的位置前的操作次数 O(len/2)…… #include<stdio.h> #include<iostream> #include<algorithm> #include<math.h> #include<string.h> #include<string>…