- 博客(70)
- 收藏
- 关注
原创 C++ Primer 笔记
Chap02 变量声明和定义的区别如果想声明一个变量而非定义它, 就在变量名前加上externextern int i; //声明i而非定义iint j; //声明并定义j变量只能被定义一次, 但可以被多次声明。如果要在多个文件中使用同一个变量,就必须将声明和定义分离,变量的定义必须且只能出现在一个文件中, 其他用到该变量的文件必须对其进行声明, 却绝不能重复定义。引用引用即别名,引用本身不是一个变量,故不能定义引用的引用。引用只能绑定在对象上。引用必须初始化,并且会和它初始绑定的变
2022-04-20 20:50:41
324
原创 (解决)Key already registered with the same priority: GroupSpatialSoftmax
(解决)Key already registered with the same priority: GroupSpatialSoftmax原因:重复安装卸载pytorch
2021-09-10 22:07:29
3506
2
原创 CMU-15112课程笔记
这是CMU-15112 Python的课程笔记很多只是课程笔记的简单摘录,便于回顾Chapter 1 Getting StartedSome Notessome bulidin constant: math.pi math.ealmost equaldef almostEqual(d1, d2): epsilon = 10**-10 return (abs(d2 - d1) < epsilon)short_circuitVariables and Funct
2021-06-01 17:00:16
2282
原创 PAT A 1056 Mice and Rice
#include<iostream>#include<queue>#include<math.h>using namespace std;struct mouse{ int weight; int rk;};int main(){ int np,ng; //n mice cin>>np>&...
2020-04-29 15:10:08
140
原创 PAT A 1051 Pop Sequence
#include<iostream>#include<stack>using namespace std;bool judge(int seq[],int n,int m){ stack<int> st; int k=1; for(int i=0;i<n;i++){ while(st.empty()==tr...
2020-04-28 19:06:42
100
原创 PAT A 1022 Digital Library
#include<iostream>#include<map>#include<set>#include<string>using namespace std;map<string,set<int> > mpTitle,mpAuthor,mpKey,mpPub,mpYear;void query(map<...
2020-04-28 10:23:58
108
原创 PAT A 1071 Speech Patterns
#include<iostream>#include<map>using namespace std;map<string,int> mp;bool IsA(char c){ if(c>='0'&&c<='9'){ return true; }else if(c>='a'&&...
2020-04-27 22:23:42
107
原创 PAT A 1054 The Dominant Color
#include<iostream>#include<map>using namespace std;map<int,int> mp;int main(){ int m,n,color; scanf("%d%d",&m,&n); for(int i=0;i<n;i++){ for(int...
2020-04-27 21:59:22
114
原创 PAT A 1100 Mars Numbers
#include<iostream>#include<map>using namespace std;map<string,int> StrToInt;map<int,string> IntToStr;string low[13]={"tret","jan","feb","mar","apr","may","jun","jly","au...
2020-04-27 21:39:55
93
原创 PAT A 1060 Are They Equal
#include<iostream>#include<string>using namespace std;struct Number{ string number; int e; Number(){ e=0; }};Number trans(string s,int n){ Number ans; ...
2020-04-25 18:24:38
84
原创 PAT A 1063 Set Similarity
#include<iostream>#include<set>using namespace std;int main(){ int n,m,number; cin>>n; set<int> v[n+1]; for(int i=1;i<=n;i++){ cin>>m; ...
2020-04-23 21:57:06
113
原创 PAT A 1047 Student List for Course
#include<iostream>#include<algorithm>#include<vector>#include<string>using namespace std;bool cmp(string a,string b){ return a<b;}int main(){ int n,k,c,in...
2020-04-22 19:11:19
102
原创 PAT A 1039 Course List for Student
#include<iostream>#include<vector>#include<map>#include<algorithm>using namespace std;int hash_s(char s[]){ int ans=0; for(int i=0;i<3;i++){ ans=ans*2...
2020-04-22 19:01:07
104
原创 PAT A 1023 Have Fun with Numbers
#include<iostream>#include<string.h>using namespace std;const int maxn=30;struct bign{ int d[maxn]; int len; bign(){ memset(d,0,sizeof(d)); len=0; }}...
2020-04-22 16:34:07
106
原创 PAT A 1059 Prime Factors
#include<iostream>#include<math.h>using namespace std;struct factor{ int x,cnt;};const int maxn=100000;int num,prime[maxn];bool p[maxn]={0};void Find_Prime(){ for(int i...
2020-04-19 23:09:05
109
原创 PAT A 1096 Consecutive Factors
#include<iostream>#include<math.h>using namespace std;typedef long long ll;int main(){ ll n,ansI=2,ansLen=0,cnt,temp; cin>>n; ll sqr=(int)sqrt(1.0*n); for(ll i...
2020-04-19 22:49:39
100
原创 PAT A 1078 Hashing
#include<iostream>#include<math.h>using namespace std;const int maxn=100010;bool hash_table[maxn]={0};bool IsPrime(int n){ if(n<=1) return false; int sqr=(int)sqr...
2020-04-19 21:07:58
145
原创 PAT A 1015 Reversible Primes
#include<iostream>#include<math.h>#include<algorithm>#include<string.h>using namespace std;int change(int n,int radix){ int len=0,d[40]; do{ d[len++]=n%r...
2020-04-18 23:14:12
109
原创 PAT A 1088 Rational Arithmetic
#include<iostream>#include<algorithm>using namespace std;struct fraction{ long long up,down;};void show(fraction ans){ int flag=0; if(ans.up==0) printf("0"); else...
2020-04-18 20:08:25
98
原创 PAT A 1081 Rational Sum
#include<iostream>#include<algorithm>using namespace std;struct Fraction{ long long up,down;};int gcd(int a,int b){ if(a<b) swap(a,b); if(b==0) return a; ...
2020-04-17 23:25:06
118
原创 PAT A 1049 Counting Ones
#include<iostream>using namespace std;int main(){ int n,a=1,ans=0; int left,right,now; cin>>n; while(n/a!=0){ left=n/(a*10); now=n/a%10; right=n...
2020-04-15 21:59:07
79
原创 PAT A 1008 Elevator
#include<iostream>using namespace std;int main(){ int n,floor; int time=0,now=0; cin>>n; for(int i=0;i<n;i++){ cin>>floor; if(floor>now) t...
2020-04-15 21:16:44
89
原创 PAT A 1104 Sum of Number Segments
#include<iostream>using namespace std;int main(){ int n; cin>>n; double ans=0,temp; for(int i=1;i<=n;i++){ scanf("%lf",&temp); ans+=temp*i*(n+1-i...
2020-04-15 20:59:48
72
原创 PAT A 1069 The Black Hole of Numbers
#include<iostream>#include<algorithm>#include<string.h>using namespace std;int getmin(int n){ int ans; char s[5]; sprintf(s,"%d",n); sort(s,s+strlen(s)); ss...
2020-04-15 20:48:31
99
原创 PAT A 1101 Quick Sort
#include<iostream>#include<algorithm>#include<vector>using namespace std;int main(){ int n; vector<int> v; cin>>n; int a[n],b[n]; for(int i=0;i&...
2020-03-30 20:50:15
118
原创 PAT A 1093 Count PAT's
#include<iostream>using namespace std;int main(){ string s; cin>>s; int total_t=0,p=0,t=0,i=0,ans=0; while(s[i]!='\0'){ if(s[i]=='T') total_t++; i++;...
2020-03-30 20:05:24
103
原创 PAT A 1029 Median
#include<iostream>#include<algorithm>using namespace std;int main(){ int len1,len2; cin>>len1; int a[len1]; for(int i=0;i<len1;i++) scanf("%d",&a[i]); ...
2020-03-30 16:58:05
89
原创 PAT A 1089 Insert or Merge
#include<iostream>#include<algorithm>#include<cmath>using namespace std;void show(int a[],int n){ for(int i=0;i<n;i++){ printf("%d",a[i]); if(i!=n-1) pr...
2020-03-30 14:32:28
100
原创 PAT A 1044 Shopping in Mars
#include<iostream>#include<algorithm>using namespace std;int main(){ int n,m; cin>>n>>m; int diamond[n+1];; diamond[0]=0; for(int i=1;i<=n;i++){ ...
2020-03-27 18:17:16
172
原创 PAT A 1010 Radix
#include<iostream>#include<cctype>#include<algorithm>#include<cmath>using namespace std;typedef long long LL;LL convert(string s,LL radix){ LL sum=0,temp; int ...
2020-03-26 19:15:34
134
原创 PAT A 1085 Perfect Sequence
#include<iostream>#include<algorithm>using namespace std;typedef long long LL;int main(){ int n,p; cin>>n>>p; LL a[n]; for(int i=0;i<n;i++) cin>...
2020-03-18 16:56:55
110
原创 PAT A 1038 Recover the Smallest Number
#include<iostream>#include<algorithm>#include<string>using namespace std;bool cmp(string a,string b){ return a+b<b+a;}int main(){ int n; cin>>n; st...
2020-03-17 15:40:54
82
原创 PAT A 1067 Sort with Swap(0, i)
#include<iostream>#include<algorithm>using namespace std;const int maxn=100010;int pos[maxn];int main(){ int n,ans=0; cin>>n; int left=n-1,num; //left存放除0以外不在本位...
2020-03-16 21:59:14
92
原创 PAT A 1037 Magic Coupon
#include<iostream>#include<algorithm>using namespace std;int main(){ int Nc,Np; cin>>Nc; int coupon[Nc]; for(int i=0;i<Nc;i++) cin>>coupon[i]; ci...
2020-03-16 15:52:55
175
原创 PAT A 1033 To Fill or Not to Fill
#include<stdio.h>#include<algorithm>#include<iostream>using namespace std;const int inf=1000000000;struct Station{ double price,dis;};bool cmp(Station a,Station b){ ...
2020-03-15 18:17:42
111
原创 PAT A 1070 Mooncake
#include<iostream>#include<algorithm>using namespace std;struct mooncake{ double inventory,price,cmp;};bool cmp(mooncake a,mooncake b){ return a.cmp>b.cmp;}int main()...
2020-03-15 15:18:30
109
原创 PAT A 1048 Find Coins
#include<iostream>#include<map>using namespace std;int main(){ int n,m,value; map<int,int> mp; cin>>n>>m; for(int i=0;i<n;i++){ cin>>...
2020-03-13 17:49:31
112
原创 PAT A 1050 String Subtraction
#include<iostream>#include<map>#include<vector>#include<string>using namespace std;int main(){ int i; char ch; vector<char> s; map<char,bool>...
2020-03-13 17:29:10
95
原创 PAT A 1041 Be Unique
#include<iostream>#include<vector>#include<map>using namespace std;int main(){ int n,i; cin>>n; vector<int> vi(n); map<int,int> mp; for(i=...
2020-03-13 17:07:49
89
原创 PAT A 1092 To Buy or Not to Buy
#include <iostream>#include<map>using namespace std;int main(){ string s1,s2; cin>>s1>>s2; map<char,int> mp; for(int i=0;i<s1.length();i++){ ...
2020-03-12 21:12:02
103
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人