↓ 跳过正文
  1. Posts/

cf 570 A. Elections

相关文章

cf 556C Case of Matryoshkas

·377 字·1 分钟
http://codeforces.com/contest/556/problem/C 果然一晚上不睡觉会导致读错题么… 需要注意的是 如果有一个是 1 2 4 6 那么 1,2是不必拆开的…. 然后我们发现,只有以1为开始且连续的套娃不必拆开….

codeforces 548 A. Mike and Fax

·234 字·1 分钟
http://codeforces.com/problemset/problem/548/A 水题。分割成K个,每个串判断是否回文,如果都是就yes,否则no 需要注意的是,可能不能正好分成长度相同的K个,这个时候也要No 代码实现 1 2 3 4 5 /* *********************************************** 6 Author :111qqz 7 Created Time :2016年03月03日 星期四 14时09分08秒 8 File Name :code/cf/problem/548A.cpp 9 ************************************************ */ 10 11 #include <algorithm> 12 #include <cstdio> 13 #include <iostream> 14 #include <cstring> 15 #include <string> 16 #include <cmath> 17 #include <map> 18 19 using namespace std; 20 const int N=1E3+5; 21 char st[N]; 22 int k,len,ave; 23 bool ok(int l,int r) 24 { 25 for (int i = l ; i<=(l+r)/2;i++) 26 if (st[i]!=st[l+r-i]) 27 return false; 28 return true; 29 } 30 31 int main() 32 { 33 cin>>st; 34 cin>>k; 35 len = strlen(st); 36 ave= len/k; 37 if (k*ave!=len){cout<<"NO"<<endl;return 0;} 38 for (int i = 1 ; i<=k;i++ ) 39 { 40 if (!ok((i-1)*ave,i*ave-1)) 41 { 42 cout<<"NO"<<endl; 43 //cout<<i<<endl; 44 return 0; 45 } 46 47 } 48 cout<<"YES"<<endl; 49 50 51 52 return 0; 53 }

cf 535B Tavas and SaDDas

·366 字·1 分钟
B. Tavas and SaDDas time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn’t stop doing that. That’s why Keione told his smart friend, SaDDas to punish him! SaDDas took Tavas’ headphones and told him: “If you solve the following problem, I’ll return it to you.” The problem is: You are given a lucky number n. Lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.