排队(学号不重复)
This commit is contained in:
parent
5e2f7f9cf7
commit
c477df0fb0
|
@ -1,5 +1,13 @@
|
||||||
#include<iostream>
|
#include<iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
bool bi(int f[],int n,int j){
|
||||||
|
for(int i=1;i<=j;i++){
|
||||||
|
if(f[i]==n){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
int main(){
|
int main(){
|
||||||
int n,a[1001]={0},f[1001]={0};
|
int n,a[1001]={0},f[1001]={0};
|
||||||
int pan=0;
|
int pan=0;
|
||||||
|
@ -10,8 +18,9 @@ int main(){
|
||||||
for(int i=a[1]-1;i>0;i--){
|
for(int i=a[1]-1;i>0;i--){
|
||||||
f[1]=i;
|
f[1]=i;
|
||||||
for(int j=2;j<=n;j++){
|
for(int j=2;j<=n;j++){
|
||||||
if(a[j-1]-f[j-1]>0){
|
int we=a[j-1]-f[j-1];
|
||||||
f[j]=a[j-1]-f[j-1];
|
if(we>0&bi(f,we,j-1)==1){
|
||||||
|
f[j]=we;
|
||||||
pan=j;
|
pan=j;
|
||||||
}else{
|
}else{
|
||||||
break;
|
break;
|
||||||
|
|
BIN
4062_dui/dui.exe
BIN
4062_dui/dui.exe
Binary file not shown.
|
@ -1,24 +1,24 @@
|
||||||
## z:\Chao\src\4062_dui\test\in.txt
|
## z:\Chao\src\4062_dui\test\in.txt
|
||||||
2020/03/28 ÖÜÁù 9:35:42.10
|
2020/03/28 ÖÜÁù 11:44:37.03
|
||||||
|
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
Process exited after 140 ms with return value 0
|
Process exited after 200 ms with return value 0
|
||||||
|
|
||||||
## z:\Chao\src\4062_dui\test\In0 (6).txt
|
## z:\Chao\src\4062_dui\test\In0 (6).txt
|
||||||
2020/03/28 ÖÜÁù 9:35:42.10
|
2020/03/28 ÖÜÁù 11:44:37.03
|
||||||
3 1 5 2 4
|
3 1 5 2 4
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
Process exited after 130 ms with return value 0
|
Process exited after 90 ms with return value 0
|
||||||
|
|
||||||
## z:\Chao\src\4062_dui\test\In1 (9).txt
|
## z:\Chao\src\4062_dui\test\In1 (9).txt
|
||||||
2020/03/28 ÖÜÁù 9:35:42.10
|
2020/03/28 ÖÜÁù 11:44:37.03
|
||||||
4 2 3 1 6 5
|
4 2 3 1 6 5
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
Process exited after 100 ms with return value 0
|
Process exited after 90 ms with return value 0
|
||||||
|
|
||||||
## z:\Chao\src\4062_dui\test\In2 (1).txt
|
## z:\Chao\src\4062_dui\test\In2 (1).txt
|
||||||
2020/03/28 ÖÜÁù 9:35:42.10
|
2020/03/28 ÖÜÁù 11:44:37.03
|
||||||
6 5 2 2 5 1 8
|
5 6 1 3 4 2 7
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
Process exited after 80 ms with return value 0
|
Process exited after 150 ms with return value 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue