首页 > 其他 > 详细

Educational Codeforces Round 54---A.........【未完成】

时间:2018-11-13 11:27:48      阅读:164      评论:0      收藏:0      [点我收藏+]

A---Minimizing the String

 

技术分享图片
 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cmath>
 4 #include<cstdlib>
 5 #include<cstring>
 6 #include<algorithm>
 7 #include<queue>
 8 using namespace std;
 9 #define ll long long
10 #define N 100010
11 #define pi 3.1415926535
12 
13 int n;
14 const int maxn = 2e5 + 5;
15 char str[maxn], ans[maxn];
16 
17 int main()
18 {
19     while(scanf("%d", &n) != EOF){
20         memset(ans, 0, sizeof(ans));
21         memset(str, 0, sizeof(str));
22         scanf("%s", str);
23         int len = 0;
24         bool flag = true;
25         for(int i = 0; i < n - 1; i++){
26             if(str[i] > str[i + 1] && flag){
27                 flag = false;
28                 continue;
29             }
30             ans[len++] = str[i];
31         }
32         if(!flag){
33             ans[len++] = str[n - 1];
34         }
35 
36 
37         printf("%s\n", ans);
38     }
39     return 0;
40 }
View Code

 

Educational Codeforces Round 54---A.........【未完成】

原文:https://www.cnblogs.com/wyboooo/p/9951225.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!