- 博客(11)
- 收藏
- 关注
原创 C++: 嵌套类
定义:一个类可以定义在另一个类的内部,前者称为嵌套类或嵌套类型。 用途:嵌套类常用于定义作为实现部分的类。 性质: 嵌套类是一个独立的类: 外层类的对象和嵌套类的对象是相互独立的; 嵌套类的对象中不包含任何外层类定义的成员,外层类的对象中不包含任何嵌套类定义的成员; 嵌套类的名字在外层类作用域中是可见的,在外层类作用域之外不可见 嵌套类中成员的种类与非嵌套类是一样的,...
2019-05-05 23:02:02
290
转载 C++: 'identifier': identifier not found [Compiler Error C3861]
模板定义阶段:刚被定义时,只有模板中独立的名字(可以理解为和模板参数无关的名字)参加查找 模板实例化阶段:实例化模板代码时,非独立的名字才参加查找。 //一个模板子类其实是不能在实例化之前就知道他的模板父类到底是谁,所以只能this->了
2019-04-22 21:28:06
1380
原创 Matlab常见操作
矩阵操作 删除(行/列)操作 % 删除矩阵A第n列A(:, n) = [];% 删除矩阵A第n行A(n, :) = [];% example>> A=[1,2,3;4,5,6;7,8,9]A = 1 2 3 4 5 6 7 8 9>> A(1, :) = [...
2019-04-06 21:27:36
222
原创 Maven: Failed to read artifact descriptor
问题:在使用Maven解决Java的依赖问题时,有时会出现如下报错:Failed to read artifact descriptor for xxx:jar环境:IntelliJ IDEA 2018.3.4 Java: 11.0.2 Maven: 4.0.0解决: 1. 点击 File -> Setting; 2. 依次选中 Build,...
2019-03-10 10:42:36
694
转载 Broken Keyboard(a.k.a.Beiju Text),UVa 11988
#include#include#includeusing namespace std;int last,cur;char s[100005];int main(){ int next[100005]; while(cin>>s+1){ int n=strlen(s+1); last=cur=0; next[0]=0; for(int i=1;i<=n;i++
2016-11-21 15:25:44
510
转载 Rails,ACM/ICPC CERC 1997,UVa 514
#include#includeusing namespace std;int n,target[1010];int main(){ while(cin>>n){ stack s; int A=1,B=1; for(int i=1;i<=n;i++){ cin>>target[i]; } int ok=1; while(B<=n){ if(A==t
2016-11-21 15:09:26
645
原创 Dropping Balls,UVa 679
#include#includeusing namespace std;int main(){ int d,k,num=1; cin>>d>>k; for(int i=0;i<d-1;i++){ if(k%2==1){num*=2;k=k+1;} else num=num*2+1; k=k/2; } cout<<num;}
2016-11-21 14:20:07
320
原创 Repeating Decimals,ACM/ICPC World Finals 1990,UVa202
#include#includeusing namespace std; int decimal[3000]; int r[3000];int main(){ int a,b; int loop=0; int integer; cin>>a>>b; integer=a/b; r[0]=a-integer*b; if(r[0]){ for(int i=0;i<300
2016-11-14 16:31:28
555
原创 Puzzle,ACM/ICPC World Finals 1993,UVa227
#include#includeusing namespace std;char word[5][6];int A(int &x,int& y){ if(y==0){cout<<"This puzzle has no final configuration"<<endl;return 2;} else {swap(word[x][y],word[x][--y]);return 0;
2016-11-14 15:28:07
661
原创 Periodic Strings,UVa455
#include#includeusing namespace std;int main(){ string str; cin>>str; int s=0; int leng=str.length(); for(int i=1;i<leng;){ if(str[s]==str[i]){s++;i++;} else if(str[0]==str[i]){s=1;i++;}
2016-11-14 14:06:10
412
原创 Score,ACM/ICPC Seoul 2005,UVa1585
#include#includeusing namespace std;int main(){ string str; cin>>str; int score(0),goal(0); int leng=str.length(); for(int i=0;i<leng;i++){ if(str[i]=='O'){ goal++; score+=goal; }
2016-11-14 13:47:08
395
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人