题目传送门

 /*
构造+暴力:按照题目意思,只要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的更多相关文章

  1. 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 ...

  2. 暴力+构造 Codeforces Round #283 (Div. 2) C. Removing Columns

    题目传送门 /* 题意:删除若干行,使得n行字符串成递增排序 暴力+构造:从前往后枚举列,当之前的顺序已经正确时,之后就不用考虑了,这样删列最小 */ /*********************** ...

  3. 数论/暴力 Codeforces Round #305 (Div. 2) C. Mike and Frog

    题目传送门 /* 数论/暴力:找出第一次到a1,a2的次数,再找到完整周期p1,p2,然后以2*m为范围 t1,t2为各自起点开始“赛跑”,谁落后谁加一个周期,等到t1 == t2结束 详细解释:ht ...

  4. 暴力 Codeforces Round #305 (Div. 2) B. Mike and Fun

    题目传送门 /* 暴力:每次更新该行的num[],然后暴力找出最优解就可以了:) */ #include <cstdio> #include <cstring> #includ ...

  5. 暴力 Codeforces Round #183 (Div. 2) A. Pythagorean Theorem II

    题目传送门 /* 暴力:O (n^2) */ #include <cstdio> #include <algorithm> #include <cstring> # ...

  6. 数学/找规律/暴力 Codeforces Round #306 (Div. 2) C. Divisibility by Eight

    题目传送门 /* 数学/暴力:只要一个数的最后三位能被8整除,那么它就是答案:用到sprintf把数字转移成字符读入 */ #include <cstdio> #include <a ...

  7. 二分查找/暴力 Codeforces Round #166 (Div. 2) B. Prime Matrix

    题目传送门 /* 二分查找/暴力:先埃氏筛选预处理,然后暴力对于每一行每一列的不是素数的二分查找最近的素数,更新最小值 */ #include <cstdio> #include < ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. [NOIP2007] 普及组

    奖学金 模拟 开个struct排序即可 c++吼啊 /*by SilverN*/ #include<algorithm> #include<iostream> #include ...

  2. Ubuntu 16.04无损分区大小调整工具Gparted

    安装: sudo apt-get install gparted 使用: 注意: 这款软件可以调整分区大小,且支持无损,但是对于/根目录的分区无法调整,但是它提供ISO工具,可以启动后进行调整. 下载 ...

  3. list去掉重复元素

    需求: 有list 里面含有重复元素,要求去掉重复元素: solution 1: >>> a [1, 2, 2, 1, 3, 4, 5, 6, 5] >>> set ...

  4. C#.NET 如何打开高版本的sln文件

    我用VS2008去打开2010版本的解决方案,提示如下   其实我可以直接打开这个csproj文件并运行   关闭之后就会提示是否创建一个新的 sln文件

  5. EC2的维护更新-总结篇及有效经验分享

    2014年10月11日 号,我们对不到10%的EC2实例的完毕了重新启动.来预防不论什么与Xen安全通报(XSA-108)相关的安全风险. 日之前都有义务遵守相关问题的保密要求.直到它被向公众公布. ...

  6. mac 查看python路径

    1,terminal : input: which python 2,  terminal: input : python  --->import sys  ----> print sys ...

  7. 嵌入式开发之8127---DM8127如何利用EDMA搬移数据

    --------------qq:1327706646 ---------------------author:midu -------------------------------datetime ...

  8. 在不同的系统中的virtualbox中安装Ubuntu SDK

    对非常多的开发人员来说.你们可能使用的不是Ubuntu操作系统.在这样的情况下,开发人员须要在自己的操作系统中(OS X及Windows)安装virtualbox,并在VirtualBox中安装Ubu ...

  9. easyUI里的checkbox编辑

    数据源如果有布尔值,那么在UI里,最合适的控件应该就是checkbox了. easyUI的datagrid中,列的checkbox酱紫设置: {field:'status',title:'Status ...

  10. 2016/2/19 css样式表 Cascading Style Sheet 叠层样式表 美化HTML网页

    一.样式表 (一)样式表的分类 1.内联样式表 和HTML联合显示,控制精确,但是可重用性差,冗余较多. 例:<p style="font-size:14px;">内联 ...