This commit is contained in:
James 2020-06-13 08:50:57 +08:00
parent 067d2d43ad
commit 6e418781f6
25 changed files with 243 additions and 0 deletions

3
1468_fenjienum/Readme.md Normal file
View File

@ -0,0 +1,3 @@
# 标题
* 内容

View File

@ -0,0 +1 @@
#

Binary file not shown.

26
1468_fenjienum/main.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <iostream>
using namespace std;
int ans=0,a[10]={1,2,4,8,16,32,64,128,256,512};
void dg(int n,int last){
if(n==0){
ans++;
return ;
}
for(int i=last;i<=10;i++){
if(n-a[i]>=0){
dg(n-a[i],i);
}else{
break;
}
}
}
int main()
{
int n;
cin>>n;
for(int i=1;i<=20;i++){
ans=0;
dg(i,0);
cout<<ans<<endl;
}
}

BIN
1468_fenjienum/main.exe Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
5

View File

View File

View File

@ -0,0 +1,76 @@
1
2
2
4
4
6
6
10
10
14
14
20
20
26
26
36
36
46
46
60
-----------------------------------------------
Process exited after 170 ms with return value 0
## z:\Chao\src\1468_fenjienum\test\in2.txt
2020/06/06 ÖÜÁù 10:13:02.87
1
2
2
4
4
6
6
10
10
14
14
20
20
26
26
36
36
46
46
60
-----------------------------------------------
Process exited after 120 ms with return value 0
## z:\Chao\src\1468_fenjienum\test\in3.txt
2020/06/06 ÖÜÁù 10:13:02.87
1
2
2
4
4
6
6
10
10
14
14
20
20
26
26
36
36
46
46
60
-----------------------------------------------
Process exited after 90 ms with return value 0

3
1485_wanpai/Readme.md Normal file
View File

@ -0,0 +1,3 @@
# 标题
* 内容

View File

@ -0,0 +1 @@
#

43
1485_wanpai/main.cpp Normal file
View File

@ -0,0 +1,43 @@
#include <iostream>
using namespace std;
int main()
{
int n,ans=0;
int ce=0;
for(int i=0;i<4;i++){
char u;
cin>>u;
if(u=='1'){
ans+=10;
cin>>u;
}
if(u>='2'&&u<='9'){
ans+=u-'0';
}else{
if(u=='J'){
ans+=11;
}
if(u=='Q'){
ans+=12;
}
if(u=='K'){
ans+=13;
}
if(u=='A'){
ans+=1;
ce++;
}
}
}
cin>>n;
if(ans>n){
cout<<"0";
}else{
while(ce>0&&ans+10<=n){
ans+=10;
ce--;
}
cout<<ans;
}
return 0;
}

BIN
1485_wanpai/main.exe Normal file

Binary file not shown.

2
1485_wanpai/test/in.txt Normal file
View File

@ -0,0 +1,2 @@
A 2 3 4
9

2
1485_wanpai/test/in2.txt Normal file
View File

@ -0,0 +1,2 @@
10 10 10 10
41

2
1485_wanpai/test/in3.txt Normal file
View File

@ -0,0 +1,2 @@
2 3 3 3
99

18
1485_wanpai/test/out.txt Normal file
View File

@ -0,0 +1,18 @@
## z:\Chao\src\1485_wanpai\test\in.txt
2020/06/06 ÖÜÁù 9:41:11.31
0
-----------------------------------------------
Process exited after 140 ms with return value 0
## z:\Chao\src\1485_wanpai\test\in2.txt
2020/06/06 ÖÜÁù 9:41:11.31
40
-----------------------------------------------
Process exited after 120 ms with return value 0
## z:\Chao\src\1485_wanpai\test\in3.txt
2020/06/06 ÖÜÁù 9:41:11.31
11
-----------------------------------------------
Process exited after 100 ms with return value 0

3
1487_fenjimu/Readme.md Normal file
View File

@ -0,0 +1,3 @@
# 标题
* 内容

View File

@ -0,0 +1 @@
#

53
1487_fenjimu/main.cpp Normal file
View File

@ -0,0 +1,53 @@
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
int m, n, a[1001] = { 0 }, all = 0,ans=0;
cin >> m >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
all += a[i];
}
if (m >= all) {
cout << "0";
return 0;
}
sort(a + 1, a + 1 + n);
all -= m;
int que = all,ji=n;
all /= n;
bool ce=0;
for (int i = 1; i <= n; i++) {
if (a[i] <= all){
que-=a[i];
ans+=a[i]*a[i];
}else{
if(ce=0){
ce=1;
ji=i;
}
que-=all;
ans+=all*all;
}
}
while(que>0){
all++;
for(int i=n;i>=ji;i--){
if(a[i]>=all){
ans=ans-(all-1)*(all-1)+all*all;
if(que==0){
break;
}
}else{
ji=i-1;
break;
}
}
}
cout<<ans;
return 0;
}

BIN
1487_fenjimu/main.exe Normal file

Binary file not shown.

2
1487_fenjimu/test/in.txt Normal file
View File

@ -0,0 +1,2 @@
10 5
2 2 2 2 3

View File

View File

View File

@ -0,0 +1,6 @@
## z:\Chao\src\1487_fenjimu\test\in.txt
2020/06/06 ÖÜÁù 11:27:42.85
-----------------------------------------------
Process exited after 21259420 ms with return value 1073807364