题目链接

https://www.patest.cn/contests/gplt/L1-023

AC代码

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <cstdlib>
#include <ctype.h>
#include <numeric>
#include <sstream>
using namespace std; typedef long long LL;
const double PI = 3.14159265358979323846264338327;
const double E = 2.718281828459;
const double eps = 1e-6;
const int MAXN = 0x3f3f3f3f;
const int MINN = 0xc0c0c0c0;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7; int main()
{
string s;
cin >> s;
int len = s.size();
int i;
int a[4] = {0};
for (i = 0; i < len; i++)
{
if (s[i] == 'G' || s[i] == 'g')
a[0]++;
else if (s[i] == 'P' || s[i] == 'p')
a[1]++;
else if (s[i] == 'L' || s[i] == 'l')
a[2]++;
else if (s[i] == 'T' || s[i] == 't')
a[3]++;
}
while (a[0] || a[1] || a[2] || a[3])
{
if (a[0])
{
printf("G");
a[0]--;
}
if (a[1])
{
printf("P");
a[1]--;
}
if (a[2])
{
printf("L");
a[2]--;
}
if (a[3])
{
printf("T");
a[3]--;
}
}
cout << endl;
}

PAT 天梯赛 L1-023. 输出GPLT 【水】的更多相关文章

  1. PAT 天梯赛 L1-026. I Love GPLT 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-026 AC代码 #include <iostream> #include <cstdio&g ...

  2. PAT 天梯赛 L2-021. 点赞狂魔 【水】

    题目链接 https://www.patest.cn/contests/gplt/L2-021 题意 给出一个若干个人名,后面给出点赞的总数,以及每个赞的标签类型,输出前三个点赞狂魔,按标签类型不同数 ...

  3. PAT 天梯赛 L1-047. 装睡 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-047 AC代码 #include <iostream> #include <cstdio&g ...

  4. PAT 天梯赛 L1-042. 日期格式化 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-042 AC代码 #include <iostream> #include <cstdio&g ...

  5. PAT 天梯赛 L1-041. 寻找250 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-041 AC代码 #include <iostream> #include <cstdio&g ...

  6. PAT 天梯赛 L1-022. 奇偶分家 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-022 AC代码 #include <iostream> #include <cstdio&g ...

  7. PAT 天梯赛 L1-016. 查验身份证 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-016 AC代码 #include <iostream> #include <cstdio&g ...

  8. PAT 天梯赛 L1-014. 简单题 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-014 AC代码 #include <iostream> #include <cstdio&g ...

  9. PAT 天梯赛 L1-012. 计算指数 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-012 AC代码 #include <iostream> #include <cstdio&g ...

  10. PAT 天梯赛 L1-010. 比较大小 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-010 AC代码 #include <iostream> #include <cstdio&g ...

随机推荐

  1. iOS 全屏播放网页视频退出后状态栏被隐藏

    使用wkWebView播放网页上的视频,播放完成后,退出视频返回到网页发现app的状态整个被隐藏了,解决方法,监听状态栏隐藏通知,在适当的时候让状态栏显示出来 [[NSNotificationCent ...

  2. export,source

    source会把定义在脚本文件中的变量放在当前shell中 export会把变量放在他所在的shell进程以及子进程shell中 子shell进程可以访问父shell进程的export 声明的变量,但 ...

  3. PHPstorm配置远程及本地服务器

    首先打开PHPStorm的设置. 找到如下页面 OPEN一个项目,路径为XAMPP的安装路径 选择Local or mounted folder 设置以上属性,upload/download proj ...

  4. Spring Java-based容器配置(二)

    组装Java-based的配置 使用@Import注解 跟在Spring XML文件里使用<import>元素加入模块化的配置相似,@Import注解同意你载入其它配置类中的@Bean定义 ...

  5. JS方法代理

    作者:Jiang, Jilin JS作为一门脚本语言.十分easy上手.外加其灵活性,能够轻而易举地扩展功能.今天,我们就聊聊JS的方法代理. 方法代理是脚本语言中常见的方法扩展形式.这样的灵活的形式 ...

  6. sublime和webstorm安装zencoding

    [webstorm] 1.下载模板,地址为http://code.google.com/p/zen-coding/downloads/list,下载以下文件 WebIDE and IntelliJ I ...

  7. 大数据(5) - HDFS中的常用API操作

    一.安装java 二.IntelliJ IDEA(2018)安装和破解与初期配置 参考链接 1.进入官网下载IntelliJ IDEA https://www.jetbrains.com/idea/d ...

  8. mySQL 开启事件存储过程

    怎样在Navicat中设置,是数据库按照记录中的日期更新状态字段 其实这个很常用,比如你网站里的某条记录的日期——比如说数据库中某条活动记录的审核日期字段已经过期,亦即当前时间已经超过审核日期,那么定 ...

  9. 浅谈push推送的一点感受

    在手机已成为生活必不可分的一部分,push服务伴随而来.ios的apns,android随着谷歌退出中国市场,各家在android的推送不断展开.有厂商的推送,如小米.华为.魅族.oppo等,还有中间 ...

  10. 结果集(ResultSet)用法

    结果集(ResultSet)是数据中查询结果返回的一种对象,可以说结果集是一个存储查询结果的对象,但是结果集并不仅仅具有存储的功能,他同时还具有操纵数据的功能,可能完成对数据的更新等. 结果集读取数据 ...