Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Jun 3, 2020
1 parent a035868 commit 2172df2
Show file tree
Hide file tree
Showing 46 changed files with 1,023 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .vscode/launch.json
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"
}
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files.associations": {
"iostream": "cpp",
"ostream": "cpp"
}
}
25 changes: 25 additions & 0 deletions .vscode/tasks.json
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"
}
]
}
53 changes: 53 additions & 0 deletions 11.cpp
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;
}
Binary file added 11.exe
Binary file not shown.
8 changes: 8 additions & 0 deletions 12.cpp
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;
}
Binary file added 12.exe
Binary file not shown.
10 changes: 10 additions & 0 deletions 13.cpp
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;
}
Binary file added 13.exe
Binary file not shown.
12 changes: 12 additions & 0 deletions 14.cpp
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;
}
Binary file added 14.exe
Binary file not shown.
9 changes: 9 additions & 0 deletions 15.cpp
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;
}
12 changes: 12 additions & 0 deletions 16.cpp
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;
}
Binary file added 16.exe
Binary file not shown.
24 changes: 24 additions & 0 deletions 4281.cpp
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;

}
Binary file added 4281.exe
Binary file not shown.
23 changes: 23 additions & 0 deletions 4282.cpp
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;
}
Binary file added 4282.exe
Binary file not shown.
63 changes: 63 additions & 0 deletions 4283.cpp
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;
}
Binary file added 4283.exe
Binary file not shown.
10 changes: 10 additions & 0 deletions 5003.cpp
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(){

}
33 changes: 33 additions & 0 deletions 5091.cpp
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;
}
}
}
Binary file added 5091.exe
Binary file not shown.
31 changes: 31 additions & 0 deletions 5092.cpp
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;
}
Binary file added 5092.exe
Binary file not shown.
Loading

0 comments on commit 2172df2

Please sign in to comment.