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 ...
随机推荐
- abp相关
在.core中增加类.并指定属性长度. nutget 中运行Add-Migration 名称 Update-Database -Verbose 迁移成功. 1.安装指定版本类库install-pack ...
- 青蛙的约会 扩展欧几里得 方程ax+by=c的整数解 一个跑道长为周长为L米,两只青蛙初始位置为x,y;(x!=y,同时逆时针运动,每一次运动分别为m,n米;问第几次运动后相遇,即在同一位置。
/** 题目:青蛙的约会 链接:https://vjudge.net/contest/154246#problem/R 题意:一个跑道长为周长为L米,两只青蛙初始位置为x,y:(x!=y,同时逆时针运 ...
- tomcat 测试页面显示
首先下载匹配jdk版本的tomcat 解压即可使用 将完成的html文件直接放置到webapps目录下的子目录中是无法使用的 原因是tomcat默认加载的是jsp文件,且需要文件配置 所以,除去在we ...
- WPF-Binding对数据的检验
设置Binding的ValidationRules属性对Binding进行检验 <StackPanel> <TextBox x:Name="txtAge" Fon ...
- SlidingMenu官方实例分析7——SlidingContent和SlidingTitleBar区别
包含ActionBar:setSlidingActionBarEnabled(true); 效果图: 不包含ActionBar:setSlidingActionBarEnabled(false); 效 ...
- 用MathType可以编辑n元乘积吗
在学习数学过程中很多的用户朋友会发现需要接触到各种数学符号.但是在编辑文档的时候很多的文档自带的符号往往不够全面,这个时候就需要专业的数学公式编辑器来解决这个问题.MathType就是在这种情况下诞生 ...
- C++ RTTI的应用
先看下方的代码,我们所处的context在<<< void* pX = (void*)pGiven; >>>处,只知道上面这些类的信息和pX指针,怎么判断pX指向对 ...
- wifidog 认证
首先简介一下什么是Portal认证.Portal认证.通常也会叫Web认证.未认证用户上网时,设备强制用户登录到特定站点,用户能够免费訪问当中的服务.当用户须要使用互联网中的其他信息时,必须在门户站点 ...
- linux之shell常用命令介绍
一.cd 切换目录 cd /etc 切换到/etc目录下 cd ~ 切换到主目录下 cd .. 返回上级目录 ...
- 学生成绩管理系统【c】
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<conio.h> #d ...