-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
unknown
authored and
unknown
committed
Jun 3, 2020
1 parent
a035868
commit 2172df2
Showing
46 changed files
with
1,023 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
// 使用 IntelliSense 了解相关属性。 | ||
// 悬停以查看现有属性的描述。 | ||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "g++.exe build and debug active file", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"miDebuggerPath": "C:\\mingw64\\bin\\gdb.exe", | ||
"setupCommands": [ | ||
{ | ||
"description": "为 gdb 启用整齐打印", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
], | ||
"preLaunchTask": "g++.exe build active file" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"files.associations": { | ||
"iostream": "cpp", | ||
"ostream": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
// 有关 tasks.json 格式的文档,请参见 | ||
// https://go.microsoft.com/fwlink/?LinkId=733558 | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "shell", | ||
"label": "g++.exe build active file", | ||
"command": "C:\\mingw64\\bin\\g++.exe", | ||
"args": [ | ||
"-g", | ||
"${file}", | ||
"-o", | ||
"${fileDirname}\\${fileBasenameNoExtension}.exe" | ||
], | ||
"options": { | ||
"cwd": "C:\\mingw64\\bin" | ||
}, | ||
"problemMatcher": [ | ||
"$gcc" | ||
], | ||
"group": "build" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main(){ | ||
double x1,x2,y1,y2,x3,x4,y3,y4; | ||
cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4; | ||
double a=y2-y1; | ||
double b=x1-x2; | ||
double c=x1*y2-y1*x2; | ||
int flag1,flag2; | ||
if(a*x3+b*y3>c){ | ||
flag1=1; | ||
} | ||
else{ | ||
if(a*x3+b*y3==c){ | ||
flag1=2; | ||
} | ||
else{ | ||
flag1=0; | ||
} | ||
} | ||
if(a*x4+b*y4>c){ | ||
flag2=1; | ||
} | ||
else{ | ||
if(a*x4+b*y4==c){ | ||
flag2=2; | ||
} | ||
else{ | ||
flag2=0; | ||
} | ||
} | ||
if(flag1==flag2){ | ||
if(flag1==2){ | ||
cout<<"P1 and P2 are both in the straight line!"<<endl; | ||
} | ||
else{ | ||
cout<<"P1 and P2 are on the same side of the straight line!"<<endl; | ||
} | ||
} | ||
else{ | ||
if(flag1==2){ | ||
cout<<"P1 is in the straight line!"<<endl; | ||
} | ||
else if(flag2==2){ | ||
cout<<"P2 is in the straight line!"<<endl; | ||
} | ||
else{ | ||
cout<<"P1 and P2 are not on the same side of the straight line!"<<endl; | ||
|
||
} | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main(){ | ||
double a; | ||
cin>>a; | ||
cout<<8+15*max(a-3,0.00)<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main(){ | ||
double x1,x2,y1,y2; | ||
cin>>x1>>y1>>x2>>y2; | ||
double x=(x1+x2)/2; | ||
double y=(y1+y2)/2; | ||
cout<<x<<","<<y<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main(){ | ||
char a,b,c; | ||
cin>>a>>b>>c; | ||
int x,y,z; | ||
x=a-'0'; | ||
y=b-'0'; | ||
z=c-'0'; | ||
cout<<(z+6)%10<<(y+6)%10<<(x+6)%10<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main(){ | ||
int a,b; | ||
cin>>a>>b; | ||
a^=b^=a^=b; | ||
cout<<a<<" "<<b<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include<iostream> | ||
#include<iomanip> | ||
using namespace std; | ||
int main(){ | ||
double deg,min,sec,rad; | ||
const double pi=3.14159; | ||
cin>>deg>>min>>sec; | ||
deg+=min/60+sec/3600; | ||
rad=deg*pi/180; | ||
cout<<setiosflags(ios::fixed)<<setprecision(2)<<rad<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int a[20]; | ||
inline void move(int* array,int n,int m){ | ||
for(int i=n;i>=1;i--){ | ||
array[i+m]=array[i]; | ||
} | ||
for(int i=1;i<=m;i++){ | ||
array[i]=array[n+i]; | ||
array[n+i]=0; | ||
} | ||
} | ||
int main(){ | ||
for(int i=1;i<=10;i++){ | ||
cin>>a[i]; | ||
} | ||
move(a,10,3); | ||
for(int i=1;i<=10;i++){ | ||
cout<<a[i]<<" "; | ||
} | ||
cout<<endl; | ||
return 0; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main(){ | ||
for(char a='A';a<='D';a++){ | ||
if((a!='B'&&a=='D')+(a!='B'&&a=='C')+(a!='A'&&a=='B')+(a!='D')==3){ | ||
if(a=='A'){ | ||
cout<<"甲"<<endl; | ||
} | ||
if(a=='B'){ | ||
cout<<"乙"<<endl; | ||
} | ||
if(a=='C'){z | ||
cout<<"丙"<<endl; | ||
} | ||
if(a=='D'){ | ||
cout<<"丁"<<endl; | ||
} | ||
return 0; | ||
} | ||
} | ||
cout<<"无"<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#include<iostream> | ||
using namespace std; | ||
struct node{ | ||
int data; | ||
node* next; | ||
}; | ||
node* CreateList(); | ||
void PrintList(node*); | ||
node* head = NULL; | ||
node* CreateList(){ | ||
node *s, *p=NULL; | ||
s = new node; | ||
// cout << "请输入一个整数值作为新结点的数据信息,输入0时建立链表结束" << endl; | ||
// cout << "第" << n + 1 << "个结点" << endl; | ||
cin>>s->data; | ||
head = NULL; | ||
if(s->data == 0){ | ||
//cout << "您建立的空链表" << endl; | ||
delete s; | ||
} | ||
else{ | ||
while(s->data != 0){ | ||
if(head == NULL)head=s; | ||
else p->next=s; | ||
p=s; | ||
s=new node; | ||
cin>>s->data; | ||
} | ||
p->next=NULL; | ||
delete s; | ||
} | ||
return head; | ||
} | ||
void PrintList(node* head){ | ||
node* p = head; | ||
int i = 1; | ||
if(head!=NULL){ | ||
do{ | ||
cout<<p->data<<endl; | ||
p=p->next; | ||
}while(p!=NULL); | ||
} | ||
else{ | ||
cout<<"空链表!"<<endl; | ||
} | ||
//cout<<"链表中共有"<<n<<"个节点"<<endl; | ||
} | ||
node* RGetKthNode(node* pHead,unsigned int k){ | ||
int n=1; | ||
if(pHead==NULL)return NULL;//空链表 | ||
for(node* p=pHead;p->next!=NULL;n++,p=p->next);//确定链表长度 | ||
node* p=pHead; | ||
for(int i=1;i<n-k+1;i++,p=p->next); | ||
return p; | ||
} | ||
int main(){ | ||
node *head = CreateList(); | ||
int k;cin>>k; | ||
node *find = RGetKthNode(head, k); | ||
if(find == NULL)cout<<"无效"; | ||
else cout<<find->data; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include<iostream> | ||
using namespace std; | ||
struct Node{ | ||
Node *next, *pre; | ||
int val; | ||
}; | ||
Node *head = nullptr; | ||
int main(){ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include<iostream> | ||
#include<cstring> | ||
using namespace std; | ||
|
||
class MyStack{ | ||
private: | ||
int m_array[10]; | ||
int m_size; | ||
public: | ||
MyStack():m_size(0){memset(m_array,0,sizeof(m_array));}; | ||
void push(int num){m_array[m_size++]=num;} | ||
int pop(){if(m_size!=0){return m_array[--m_size];}} | ||
void print(){cout<<"( ";for(int i=0;i<m_size;i++){cout<<m_array[i]<<" ";}cout<<")";} | ||
}; | ||
|
||
int main(){ | ||
char order; | ||
int num; | ||
MyStack* S = new MyStack; | ||
while(cin>>order){ | ||
if(order=='i'){ | ||
cin>>num; | ||
S->push(num); | ||
} | ||
if(order=='o'){ | ||
S->pop(); | ||
} | ||
if(order=='s'){ | ||
S->print(); | ||
return 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main(){ | ||
int loseA=0,loseB=0,N; | ||
cin>>N; | ||
int a,b,c,d; | ||
bool flag = 0; | ||
for(int i=1;i<=N;i++){ | ||
cin>>a>>b>>c>>d; | ||
if(!flag){ | ||
if(b==d){ | ||
if(b==a+c){ | ||
loseA++; | ||
loseB++; | ||
} | ||
} | ||
else{ | ||
if(b==a+c){ | ||
loseB++; | ||
flag = 1; | ||
} | ||
if(d==a+c){ | ||
loseA++; | ||
flag = 1; | ||
} | ||
} | ||
} | ||
} | ||
cout<<loseA<<" "<<loseB<<endl; | ||
return 0; | ||
} |
Oops, something went wrong.