PAT 天梯赛 L1-023. 输出GPLT 【水】
题目链接
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 【水】的更多相关文章
- PAT 天梯赛 L1-026. I Love GPLT 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-026 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L2-021. 点赞狂魔 【水】
题目链接 https://www.patest.cn/contests/gplt/L2-021 题意 给出一个若干个人名,后面给出点赞的总数,以及每个赞的标签类型,输出前三个点赞狂魔,按标签类型不同数 ...
- PAT 天梯赛 L1-047. 装睡 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-047 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-042. 日期格式化 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-042 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-041. 寻找250 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-041 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-022. 奇偶分家 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-022 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-016. 查验身份证 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-016 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-014. 简单题 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-014 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-012. 计算指数 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-012 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-010. 比较大小 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-010 AC代码 #include <iostream> #include <cstdio&g ...
随机推荐
- 分分钟学会一门语言之Python篇
转自:http://www.code123.cc/1049.html Python 是 90 年代初由 Guido Van Rossum 创立的.它是当前最流行的程序语言之一.它那纯净的语法令我一见倾 ...
- centos 源码安装apache 之apr、apr-util
apr 和 apr-util官网下载地址: http://apr.apache.org/download.cgi 安装顺序是先安装apr然后再安装 apr-util,因为安装apr-util需要apr ...
- HugePage简介和KVM中使用HugePage
现在,有许多的处理器架构都支持多种的内存页大小,其中就包括比一般的page size大很多的huge page.就目前来说,尽管在个人电脑中基本都实现了对huge page的支持,然而,huge pa ...
- request:getParameter和getAttribute区别
getParameter 是用来接受用post个get方法传递过来的参数的.getAttribute 必须先setAttribute.(1)request.getParameter() 取得是通过容器 ...
- Java进阶03 IO基础(转载)
IO示例 下面是演示的文件file.txt Hello World! Hello Nerd! 先来研究一个文件读取的例子: import java.io.*;public class Test{ pu ...
- ORA-06519: 检测到活动的自治事务处理,已经回退
写了一个函数,由于在定义时加入了 create or replace function F_计算结果(In_参数 varchar2) return number is --使用自治事务PRAGMA A ...
- Laravel 5.1 Blade模板引擎
为什么要使用blade 它是干什么用的? blade模板引擎使我们写HTML页面的地方,使用它是因为它能给我们提供很多的遍历,减少代码的重复率 提高开发效率.我们写blade的路径是 resource ...
- SSH后台管理系统,实现查询+分页
一个搜索框,然后会获取大量信息,将信息进行分页,每一页显示固定条数. mysql中使用“like”和“%%”进行模糊匹配,用“limit”进行分页. 1.首先创建一个页面信息的实体类,代码如下: im ...
- LINUX手动查看和修改MTU值的方法
默认的ANDROID系统中不带BUSYBOX,所以无法用BUSYBOX IFCONFIG来查看修改MTU值.其实网卡的MTU值是保存在/sys/class/net/eth0/mtu文件中,所以可以通过 ...
- mysql with python
前言: 数据库为人类解决了三大问题:持久化存储.优化读写.数据标准化. MySQL它不是数据库,它是管理数据库的软件.MySQL管理了很多数据库.是典型的服务型数据库,需要TCP/IP去连接. MyS ...