- 博客(25)
- 收藏
- 关注
原创 1157 Anniversary(PTA甲级)
简单排序--用map统计来的人数#include<bits/stdc++.h>using namespace std;unordered_map<string,int> ha;int cou=0;string ans;int test(string s){ return ha[s];}int cmp(string a,string b){ string a1=a.substr(6,8); string b1=b.substr(6,8); if(
2022-05-27 11:52:57 91
原创 1136 A Delayed Palindrome
数组模拟加法#include<bits/stdc++.h>#include<cstring>using namespace std;typedef long long int ll;string s;bool test(string s){ int l=0,r=s.length()-1; while(l<r){ if(s[l]!=s[r])return 0; l++; r--; } cout<<s<<" is a
2022-05-25 21:17:23 62
原创 PTA甲级1164 Good in C
注意最后的句子有空格 要用getline读入#include<bits/stdc++.h>#include<cstring>using namespace std;typedef long long int ll;class alp{ public: string s[70];};alp arr[100];int flat=0;void pri(string s){ if(flat==0){ flat=1; } else cout&l
2022-05-25 18:51:17 88
原创 1075 PAT Judge
注意0分也是成功提交0分以下算作0 但不算有效提交只要有有效提交 即使总分为0 也要输出#include<bits/stdc++.h>#include<cstring>using namespace std;typedef long long int ll;int n,k,m;bool st[1000010];class stu{ public: int id,sums=0,num=0; int sans[6]; };
2022-05-25 17:13:21 65
原创 PTA1055 The World‘s Richest
大体思路:结构体数组排序 ,注意输出截止条件(指定个数后不再向下扫描),每个年龄仅取前一百人#include<bits/stdc++.h>#include<cstring>using namespace std;typedef long long int ll;class st{ public: string name; int age,v;};unordered_map<int,int>ha;vector<st>arr;
2022-05-24 21:35:18 63
原创 PAT1028 List Sorting
#include<bits/stdc++.h>#include<cstring>using namespace std;typedef long long int ll;class stu{ public: int no,fen; string id; }; int c,n;vector<stu>arr;int cmp(stu a,stu b){ if(c==1)return a.no<b.no; else if(c==2).
2022-05-23 22:24:12 56
原创 1025 PAT Ranking
#include<bits/stdc++.h>using namespace std;typedef long long int ll;unordered_map<string,int>kao,ha,p1,p2;int n;vector<string>arr;int cmp(string a,string b){ if(ha[a]==ha[b])return a<b; return ha[a]>ha[b];}int main().
2022-05-05 19:46:38 139
原创 1012 The Best Rank
对于每一次查询 遍历所有数据 找到大于自己的个数加一就是排名#include<bits/stdc++.h>using namespace std;typedef long long int ll;int n,m;map<int,int>ha1,ha2,ha3,ha4;vector<int>ans;int main(){ cin>>n>>m; for(int i=0;i<n;i++){ int a; cin&
2022-05-05 19:12:58 137
原创 1077 Kuchiguse
题目大意--求最长公共后缀tips(1)先翻转再求#include<bits/stdc++.h>using namespace std;typedef long long int ll;int n;string ans;int main(){ cin>>n; n--; getline(cin,ans); getline(cin,ans); reverse(ans.begin(),ans.begin()+ans.size()); while(n
2022-05-05 09:25:54 138
原创 1035 Password
(1)使用string.find检测是否存在目标字符(2)使用正则表达式进行替换#include<bits/stdc++.h>using namespace std;typedef long long int ll;int n;unordered_map<string,string> ha;vector<string>ans;int test(string s){ if(s.find('1')!=-1||s.find('0')!=-1||
2022-05-04 17:45:35 55
原创 1001 A+B Format
采用to_string用i%3==s.length()%3控制逗号输出#include<bits/stdc++.h>using namespace std;int main(){ int a,b; cin>>a>>b; string ans=to_string(abs(a+b)); if(a+b<0)cout<<"-"; for(int i=0;i<ans.length();i++){ cout<<ans[
2022-05-03 20:45:21 102
原创 1073 Scientific Notation
正则表达式的暴力写法分割E前面和后面的部分 逐步交换 最后控制输出格式#include<bits/stdc++.h>using namespace std;typedef long long int ll;string s;int main(){ cin>>s; if(s[0]=='-'){ cout<<s[0]; } s=s.substr(1,s.length()-1); string s1=regex_replace(s,re
2022-05-03 20:12:55 62
原创 1061 Dating
不说废话先上代码中文链接#include<bits/stdc++.h>using namespace std;typedef long long int ll;string s1,s2,s3,s4;string arr[]={"MON","TUE","WED","THU","FRI","SAT","SUN"};bool testA(char a){ if(a>='A'&&a<='G')return 1; return 0;}bool
2022-05-03 17:03:36 52
原创 PAT(甲级)用到的模板以及知识点整理
//将数 取余 到1-modn=(n-1)%mod+1//惯用将问题分成两部分d1=sum-d2//两个正数之和相加等于负数表示发生了正溢出//两个负数之和相加等于正数表示发生了负溢出//模拟输出就先进行模拟分配 //进制转换模板 do{ arr.push_back(n%mod); n/=mod; } while(n!=0);...
2022-05-03 16:59:30 90
原创 1058 A+B in Hogwarts
简单的进制转换将数字转换成最小单位进行处理注意转换成最小单位时可能会溢出 int 所以采用 long long int#include<bits/stdc++.h>using namespace std;typedef long long int ll;ll n=0;vector<ll>ans;int main(){ ll a,b,c; scanf("%lld.%lld.%lld",&a,&b,&c); n+=a*17*29+
2022-05-02 21:49:18 41
原创 1027 Colors in Mars
简单的进制转换#include<bits/stdc++.h>using namespace std;void pri(int n){ //先转换为十进制 int t=n; vector<int>arr; do{ arr.push_back(t%13); t/=13; }while(t!=0); if(arr.size()==1)cout<<0; for(int i=arr.size()-1;i>=0;i-
2022-05-02 21:31:43 200
原创 1019 General Palindromic Number
不说废话先上代码#include<bits/stdc++.h>using namespace std;int n,mod;vector<int>arr; void jud(vector<int> arr){ int l=0,r=arr.size()-1; while(l<r){ if(arr[l++]!=arr[r--]){ cout<<"No"<<endl; return ; } } cout&
2022-05-02 20:58:33 52
原创 1031 Hello World for U
不说废话先上代码原题链接#include<bits/stdc++.h>using namespace std;string s;char arr[100][100];int in=1;int l=0;int cnt=0;int main(){ for(int i=0;i<100;i++){ for(int j=0;j<100;j++)arr[i][j]=' '; } getline(cin,s); int n=s.length()-1;
2022-05-02 14:51:05 283
原创 1036 Boys vs Girls
#include<bits/stdc++.h>using namespace std;string ans1="Absent",ans2="Absent";int num1=-1,num2=101;map<string ,string>ha;int n;int main(){ ha["Absent"]=""; cin>>n; for(int i=0;i<n;i++){ string na,se,id; int num; ci.
2022-05-01 21:29:26 44
原创 1006 Sign In and Sign Out
过于简单 注意时间的输入格式 以及将其转换成秒即可#include<bits/stdc++.h>using namespace std;int n;string ans1,ans2;int t1=100000,t2=-1;int main(){ cin>>n; for(int i=0;i<n;i++){ string s; cin>>s; int a,b,c,d,e,f; scanf("%d:%d:%d",&a,
2022-05-01 21:14:47 61
原创 1009 Product of Polynomials
不说废话先上代码原题链接#include<bits/stdc++.h>using namespace std;map<int,double>p1,p2,ans;int main(){ int n1,n2;cin>>n1;for(int i=0;i<n1;i++){ int expo; cin>>expo; cin>>p1[expo];}cin>>n2;for(int i=0;i<n2;i
2022-04-27 19:45:31 107
原创 1002 A+B for Polynomials
不说废话先上代码原题链接#include<bits/stdc++.h>using namespace std;typedef long long ll;map<int,double>ans;int main(){ int n1,n2; cin>>n1; for(int i=0;i<n1;i++){ int a; double b; cin>>a>>b; ans[-a]+=b; } cin>
2022-04-26 22:33:34 239
原创 1065 A+B and C
不说废话先上代码#include<bits/stdc++.h>using namespace std;typedef long long int ll;ll a,b,c;int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ bool flag; scanf("%lld %lld %lld",&a,&b,&c); ll res=a+b; if(
2022-04-25 22:45:08 328 1
原创 1046 Shortest Distance
题目描述The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specification:Each input file contains one test case. For each case, the first line c
2022-04-25 22:02:02 99
原创 1042 Shuffling Machine
问题描述Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid "inside jobs" where employees collaborate with gamblers by performing inadequate shuffles, many casinos
2022-04-25 15:32:52 1293
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人