![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PTA
xiu_cs
所有博客仅作为个人笔记用,内容写的乱七八糟,不要参考
Do what you want to do.
展开
-
计蒜客 走迷宫 dfs
#include<iostream> #include<string.h> #include<stdio.h> #include<cstdio> using namespace std; char Map[11][11]; int n,m; int ans = 0; int X[4] = {0,0,1,-1}; int Y[4] = {1,-1,0,0}; bool vis[11][11] ={false}; void dfs(int x,int y){ i原创 2020-06-22 11:29:10 · 197 阅读 · 0 评论 -
A1091 Acute Stroke
#include<iostream> #include<queue> #include<stdio.h> using namespace std; int M,N,L,T; struct node{ int x,y,z; }Node; int X[6] = {0, 0,-1,1,0,0};//上下左右前后 int Y[6] = {0, 0, 0,0,1,-1}; int Z[6] = {1,-1, 0,0,0,0}; int p[61][1290][130]; boo原创 2020-06-22 00:49:28 · 151 阅读 · 0 评论 -
PTA A1040 Longest Symmetric String
#include<iostream> #include<cstdio> #include<algorithm> #include<string.h> using namespace std; int dp[1010][1010]; int main(){ //freopen("in.txt","r",stdin); string s; getline(cin,s); memset(dp,0,sizeof(dp)); int ans = 1; int原创 2020-06-20 11:51:49 · 125 阅读 · 0 评论 -
A 1045 Favorite Color Stripe
方法1:哈希转换为LIS问题 #include<iostream> #include<algorithm> #include<string.h> using namespace std; int Hash[210]; int A[10010]; int dp[10010]; int main(){ // freopen("in.txt","r",stdin); int N,M; memset(Hash,-1,sizeof(Hash)); cin>>N&g原创 2020-06-20 11:03:09 · 122 阅读 · 0 评论 -
A1007 Maximum Subsequence Sum 动态规划
#include<iostream> #include<stdio.h> #include<string.h> using namespace std; long long int dp[10010]; int v[10010]; int s[10010]; int main(){ int n; //freopen("in.txt","r",stdin); scanf("%d",&n); dp[0] = 0; int end =1; long long原创 2020-06-06 12:08:33 · 127 阅读 · 0 评论 -
A1008 Elevator
#include<iostream> #include<stdio.h> using namespace std; int main(){ int n; scanf("%d",&n); int time = 0; int t = 0; int now = 0; for(int i = 1;i<=n;i++){ scanf("%d",&t); if(t>=now){ time += (t-now)*6+5; } if(t原创 2020-06-01 11:23:27 · 154 阅读 · 0 评论 -
PAT B1003 我要通过!
方法1: 指针 #include<iostream> #include<stdio.h> #include<string.h> using namespace std; int main(){ int n; scanf("%d",&n); getchar(); char s[110]; char* p; int a,b,c; int P,T; while(n--){ scanf("%s",&s); a = b= c = 0; P原创 2020-05-31 12:46:53 · 151 阅读 · 0 评论 -
B1016 部分A+B
#include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int P(int A,int Da){ int m = 0; int t =1; while(A>0){ if(A%10==Da){ m += Da*t; t = t*10; } A = A/10; } return m;原创 2020-05-25 16:13:01 · 92 阅读 · 0 评论 -
B 1011 A+B 和 C
方法1 #include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int main(){ int n; cin>>n; string a,b,c; int s1[12],s2[12]; int t =1; while(t<=n){ cin>>a>>b>>c原创 2020-05-25 15:51:30 · 108 阅读 · 0 评论 -
A1001 A+B Format
#include<iostream> #include<stdio.h> #include<algorithm> using namespace std; int main(){ int a,b,c; cin>>a>>b; int sum = a+b; a=b=c=0; bool flag1 =false; if(abs(sum)>=1000){ a = sum%1000; sum =sum/1000; flag1 =原创 2020-05-25 00:21:54 · 131 阅读 · 0 评论 -
PAT B1019 数字黑洞 /A1069 The Black Hole of Numbers
#include<iostream> #include<stdio.h> #include<algorithm> bool cmp(int a,int b){ //递减排序 cmp return a>b; } using namespace std; int main(){ int N; cin>>N; int s1[4]; int s2[4]; int t = N; int index = 4; while(index--){原创 2020-05-24 17:27:59 · 179 阅读 · 0 评论 -
PAT (Basic Level) Practice 完美数列
using namespace std; #include<bits/stdc++.h> double v[100001]; int main(){ int N,p; cin>>N>>p; int t,i,j; int count=0; for(i=0;i<N;i++){ cin>>v[i]; } sort(v,v+N...原创 2020-01-31 09:42:06 · 168 阅读 · 0 评论