构造+暴力 Codeforces Round #283 (Div. 2) B. Secret Combination
/*
构造+暴力:按照题目意思,只要10次加1就变回原来的数字,暴力枚举所有数字,string大法好!
*/
/************************************************
Author :Running_Time
Created Time :2015-8-3 8:43:02
File Name :A.cpp
*************************************************/ #include <cstdio>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <cstdlib>
#include <ctime>
using namespace std; #define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
typedef long long ll;
const int MAXN = 1e3 + ;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + ;
string mn, now, str;
int n; int main(void) { //Codeforces Round #283 (Div. 2) B. Secret Combination
while (cin >> n) {
cin >> str; mn = str; now = str;
for (int i=; i<=; ++i) {
for (int j=; j<n; ++j) {
if (now[j] == '') now[j] = '';
else now[j]++;
}
cout << now << endl;
for (int j=; j<n; ++j) {
string tmp = "";
for (int k=j; k<n; ++k) tmp += now[k];
for (int k=; k<j; ++k) tmp += now[k];
if (tmp < mn) mn = tmp;
}
}
cout << mn << endl;
} return ;
}
构造+暴力 Codeforces Round #283 (Div. 2) B. Secret Combination的更多相关文章
- Codeforces Round #283 (Div. 2) B. Secret Combination 暴力水题
		
B. Secret Combination time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
 - 暴力+构造 Codeforces Round #283 (Div. 2) C. Removing Columns
		
题目传送门 /* 题意:删除若干行,使得n行字符串成递增排序 暴力+构造:从前往后枚举列,当之前的顺序已经正确时,之后就不用考虑了,这样删列最小 */ /*********************** ...
 - 数论/暴力 Codeforces Round #305 (Div. 2) C. Mike and Frog
		
题目传送门 /* 数论/暴力:找出第一次到a1,a2的次数,再找到完整周期p1,p2,然后以2*m为范围 t1,t2为各自起点开始“赛跑”,谁落后谁加一个周期,等到t1 == t2结束 详细解释:ht ...
 - 暴力 Codeforces Round #305 (Div. 2) B. Mike and Fun
		
题目传送门 /* 暴力:每次更新该行的num[],然后暴力找出最优解就可以了:) */ #include <cstdio> #include <cstring> #includ ...
 - 暴力 Codeforces Round #183 (Div. 2) A. Pythagorean Theorem II
		
题目传送门 /* 暴力:O (n^2) */ #include <cstdio> #include <algorithm> #include <cstring> # ...
 - 数学/找规律/暴力 Codeforces Round #306 (Div. 2) C. Divisibility by Eight
		
题目传送门 /* 数学/暴力:只要一个数的最后三位能被8整除,那么它就是答案:用到sprintf把数字转移成字符读入 */ #include <cstdio> #include <a ...
 - 二分查找/暴力 Codeforces Round #166 (Div. 2) B. Prime Matrix
		
题目传送门 /* 二分查找/暴力:先埃氏筛选预处理,然后暴力对于每一行每一列的不是素数的二分查找最近的素数,更新最小值 */ #include <cstdio> #include < ...
 - Codeforces Round #283 (Div. 2) A ,B ,C 暴力,暴力,暴力
		
A. Minimum Difficulty time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
 - Codeforces Round #283 (Div. 2) C. Removing Columns 暴力
		
C. Removing Columns time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
 
随机推荐
- 杜教筛--51nod1239 欧拉函数之和
			
求$\sum_{i=1}^{n}\varphi (i)$,$n\leqslant 1e10$. 这里先把杜教筛的一般套路贴一下: 要求$S(n)=\sum_{i=1}^{n}f(i)$,而现在有一数论 ...
 - Jquery那些事
			
Jquery选择器介绍: 我们可以通过Jquery选择器从网页文档中找到我们需要的DOM节点: 主要还时看文档!! (1)基本选择器 属性id 类别class 文档标签 (2)属性选 ...
 - mysql 排序order by可以根据权重,进行表达式计算。再排序
			
1.select * from tbl_actor order by (follower_count+Recommend_weight)*weight_ratio desc limit 3; 2.or ...
 - laravel notification
			
mail篇 public function via($notifiable) { return ['mail']; } 1.新建notification类 php artisan make:notif ...
 - POJ 1849 Two(遍历树)
			
POJ 1849 Two(遍历树) http://poj.org/problem?id=1849 题意: 有一颗n个结点的带权的无向树, 在s结点放两个机器人, 这两个机器人会把树的每条边都走一遍, ...
 - java UDP聊天与文件传输
			
package rgy.com.UDP3; import java.awt.Font; import java.awt.GridLayout; import java.awt.event.Action ...
 - 嵌入式开发之函数解析---ip地址2进制转字符inet_ntoa 调用中只生效一次
			
inet_addr() 简述:将一个点间隔地址转换成一个in_addr. #include <winsock.h> unsigned long PASCAL FAR inet_addr ...
 - swift 笔记 (二十一) —— 高级运算符
			
高级运算符 位运算符 按位取反: ~ 按位与运算: & 按位或运算: | 按位异或运算: ^ 按位左移运算: << 按位右移动算: >> 溢出运算符 自从swif ...
 - 【bzoj2282】[Sdoi2011]消防
			
两次bfs可得直径,答案一定不会小于所有点到直径的距离最大值,只要把直径上的边权设为0,任选直径上一点bfs可得将最大值作为二分下界,二分直径左右端点的舍弃部分 #include<algorit ...
 - from import 引入 变量 函数