Codeforces 595B - Pasha and Phone】的更多相关文章

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…
题目链接:http://codeforces.com/problemset/problem/557/B 题目意思:有 2n 个茶杯,规定第 i 个茶杯最多只能装 ai 毫升的水.现在给出 w 毫升的水,需要把这 w 毫升(可以不用光)的水倒入到这 2n 个茶杯中,使得分给 n 个男的每个水杯的水恰好是 n 个女的2倍(注意,n 个男的水杯装的水是一样的,n 个女也是).现在问的是,怎样使得 2n 个杯装的水最多,求出这个值. ***********************************…
题目链接: http://codeforces.com/problemset/problem/595/B 题意: 有一个n位的电话号码,每位电话号码将分成n/k段,每段均为k个数,求出满足以下要求的电话号码个数 1)第i段可以整除a[i]: 2)第i段不能以数字b[i]开头. 解题思路: 1. 第i段能被a[i]整除的的个数z=(10^k-1)/a[i]+1; 2. 能被a[i]整除但以b[i]开头的个数y有:设 MIN=b[i]*10^(k-1),MAX=(b[i]+1)*10^(k-1)-1…
简单贪心.... 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…
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>…
#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); } ; }…
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 should make it…