- 博客(9)
- 问答 (1)
- 收藏
- 关注
原创 1030 Travel Plan(纯暴力DFS,30分,没有用Dijkstra)
#include<iostream> #include<vector> using namespace std; const int inf=99999999; int N,M,S,D; int Cost[510][510]; int Dis[510][510]; vector<int> temppath,path; bool visit[510]={false}; int mincost=inf; int mindis=inf; void dfs(int x,in.
2022-03-31 16:16:35
136
1
原创 1114 Family Property
#include<iostream> #include<algorithm> #include<vector> #include<unordered_set> using namespace std; struct node{ int totalnum; double totoalsets; double totoalarea; double avgarea; double avgset; }family[10000]; bool visited.
2021-12-21 15:44:10
105
原创 1028 List Sorting
#include<iostream> #include<string> #include<algorithm> using namespace std; struct student{ string ID; string name; int grade; }stu[100001]; bool cmp1(student a,student b){ return a.ID<b.ID; } bool cmp2(student a,student b){ i.
2021-12-13 10:38:35
517
原创 1116 Come on Let‘s C
#include<iostream> #include<vector> using namespace std; bool isPrime(int x){ if(x==1) return false; for(int i=2;i*i<=x;i++) if(x%i==0) return false; return true; } struct node{ string ID; string reward; bool isvisit=false; }N.
2021-12-11 15:23:09
101
原创 1136 A Delayed Palindrome
采用大整数加法计算。 #include<bits/stdc++.h> using namespace std; string s; void add(string x){ int flag=0; for(int i=x.length()-1;i>=0;i--){ int temp=s[i]-'0'+x[i]-'0'+flag; flag=0; if(temp>9){ temp=temp-10; flag=1; } s[i]=temp+'0';
2021-12-11 10:54:32
235
转载 Palindromic Number
代码参考了链接:PAT甲级 1024. Palindromic Number (25) 大整数相加(利用字符串模拟整数相加)_love music.的博客-优快云博客 其中对于大整数加饭,add模板是通用的,实现两个超过long long范围整数的加法。 注意single number也是满足要求的 #include<iostream> #include<algorithm> using namespace std; string s; void add(st
2021-12-09 20:28:43
233
原创 1023 Have Fun with Numbers
使用map<char,int>来记录不同char类型数字出现的次数,成立条件为map1==map2(各种数字出现的个数相等) 用string类型处理字符串,唯一需要注意的是对string做double处理后可能需要进位 #include<iostream> #include<string> #include<map> using namespace std; map<char,int> mp1,mp2; string Double(strin
2021-12-08 20:32:42
513
原创 Group Photo(PAT)
#include<iostream> #include<algorithm> #include<cstring> #include<vector> using namespace std; struct node{ string name; int height; }; vector<node> v; bool cmp(node a, node b){ if(a.height!=b.height) return a.height&...
2021-12-06 17:53:26
258
原创 Hello world for U
#include<iostream> #include<cstring> #include<cmath> using namespace std; int main(){ string str; cin>>str; int n=str.length()+2; int n1=n/3; int n2=n-2*n1; int k=n2-2;//to record the spaceplace's number ...
2021-12-06 16:10:36
529
空空如也
1023 Have Fun with Numbers
2021-12-08
TA创建的收藏夹 TA关注的收藏夹
TA关注的人