排队(wrong???
This commit is contained in:
parent
4711b88b92
commit
5e2f7f9cf7
|
@ -0,0 +1,3 @@
|
|||
# 标题
|
||||
|
||||
* 内容
|
|
@ -0,0 +1,3 @@
|
|||
# 标题
|
||||
|
||||
* 1 3 3 4 2
|
Binary file not shown.
|
@ -0,0 +1,27 @@
|
|||
#include<iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int n,a[1001]={0},f[1001]={0};
|
||||
int pan=0;
|
||||
cin>>n;
|
||||
for(int i=1;i<n;i++){
|
||||
cin>>a[i];
|
||||
}
|
||||
for(int i=a[1]-1;i>0;i--){
|
||||
f[1]=i;
|
||||
for(int j=2;j<=n;j++){
|
||||
if(a[j-1]-f[j-1]>0){
|
||||
f[j]=a[j-1]-f[j-1];
|
||||
pan=j;
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(pan==n){
|
||||
for(int j=1;j<=n;j++){
|
||||
cout<<f[j]<<" ";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,6 @@
|
|||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hello Easy C++ project!" << std::endl;
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
5
|
||||
4 6 7 6
|
|
@ -0,0 +1,2 @@
|
|||
6
|
||||
6 5 4 7 11
|
|
@ -0,0 +1,2 @@
|
|||
7
|
||||
11 7 4 7 6 9
|
|
@ -0,0 +1,24 @@
|
|||
## z:\Chao\src\4062_dui\test\in.txt
|
||||
2020/03/28 ÖÜÁù 9:35:42.10
|
||||
|
||||
-----------------------------------------------
|
||||
Process exited after 140 ms with return value 0
|
||||
|
||||
## z:\Chao\src\4062_dui\test\In0 (6).txt
|
||||
2020/03/28 ÖÜÁù 9:35:42.10
|
||||
3 1 5 2 4
|
||||
-----------------------------------------------
|
||||
Process exited after 130 ms with return value 0
|
||||
|
||||
## z:\Chao\src\4062_dui\test\In1 (9).txt
|
||||
2020/03/28 ÖÜÁù 9:35:42.10
|
||||
4 2 3 1 6 5
|
||||
-----------------------------------------------
|
||||
Process exited after 100 ms with return value 0
|
||||
|
||||
## z:\Chao\src\4062_dui\test\In2 (1).txt
|
||||
2020/03/28 ÖÜÁù 9:35:42.10
|
||||
6 5 2 2 5 1 8
|
||||
-----------------------------------------------
|
||||
Process exited after 80 ms with return value 0
|
||||
|
Loading…
Reference in New Issue