Compare commits
2 Commits
067d2d43ad
...
f457f39977
Author | SHA1 | Date | |
---|---|---|---|
f457f39977 | |||
6e418781f6 |
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -24,7 +24,8 @@
|
||||
"vector": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"unordered_set": "cpp",
|
||||
"string_view": "cpp"
|
||||
"string_view": "cpp",
|
||||
"cmath": "cpp"
|
||||
},
|
||||
"terminal.integrated.automationShell.windows": "cmd.exe",
|
||||
"files.encoding": "gb18030",
|
||||
|
3
1468_fenjienum/Readme.md
Normal file
3
1468_fenjienum/Readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# 标题
|
||||
|
||||
* 内容
|
1
1468_fenjienum/doc/Readme.md
Normal file
1
1468_fenjienum/doc/Readme.md
Normal file
@ -0,0 +1 @@
|
||||
#
|
BIN
1468_fenjienum/doc/数的分解.pdf
Normal file
BIN
1468_fenjienum/doc/数的分解.pdf
Normal file
Binary file not shown.
26
1468_fenjienum/main.cpp
Normal file
26
1468_fenjienum/main.cpp
Normal 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
BIN
1468_fenjienum/main.exe
Normal file
Binary file not shown.
1
1468_fenjienum/test/in.txt
Normal file
1
1468_fenjienum/test/in.txt
Normal file
@ -0,0 +1 @@
|
||||
5
|
0
1468_fenjienum/test/in2.txt
Normal file
0
1468_fenjienum/test/in2.txt
Normal file
0
1468_fenjienum/test/in3.txt
Normal file
0
1468_fenjienum/test/in3.txt
Normal file
76
1468_fenjienum/test/out.txt
Normal file
76
1468_fenjienum/test/out.txt
Normal 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
3
1485_wanpai/Readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# 标题
|
||||
|
||||
* 内容
|
1
1485_wanpai/doc/Readme.md
Normal file
1
1485_wanpai/doc/Readme.md
Normal file
@ -0,0 +1 @@
|
||||
#
|
43
1485_wanpai/main.cpp
Normal file
43
1485_wanpai/main.cpp
Normal 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
BIN
1485_wanpai/main.exe
Normal file
Binary file not shown.
2
1485_wanpai/test/in.txt
Normal file
2
1485_wanpai/test/in.txt
Normal file
@ -0,0 +1,2 @@
|
||||
A 2 3 4
|
||||
9
|
2
1485_wanpai/test/in2.txt
Normal file
2
1485_wanpai/test/in2.txt
Normal file
@ -0,0 +1,2 @@
|
||||
10 10 10 10
|
||||
41
|
2
1485_wanpai/test/in3.txt
Normal file
2
1485_wanpai/test/in3.txt
Normal file
@ -0,0 +1,2 @@
|
||||
2 3 3 3
|
||||
99
|
18
1485_wanpai/test/out.txt
Normal file
18
1485_wanpai/test/out.txt
Normal 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
3
1487_fenjimu/Readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# 标题
|
||||
|
||||
* 内容
|
1
1487_fenjimu/doc/Readme.md
Normal file
1
1487_fenjimu/doc/Readme.md
Normal file
@ -0,0 +1 @@
|
||||
#
|
53
1487_fenjimu/main.cpp
Normal file
53
1487_fenjimu/main.cpp
Normal 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
BIN
1487_fenjimu/main.exe
Normal file
Binary file not shown.
2
1487_fenjimu/test/in.txt
Normal file
2
1487_fenjimu/test/in.txt
Normal file
@ -0,0 +1,2 @@
|
||||
10 5
|
||||
2 2 2 2 3
|
0
1487_fenjimu/test/in2.txt
Normal file
0
1487_fenjimu/test/in2.txt
Normal file
0
1487_fenjimu/test/in3.txt
Normal file
0
1487_fenjimu/test/in3.txt
Normal file
6
1487_fenjimu/test/out.txt
Normal file
6
1487_fenjimu/test/out.txt
Normal 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
|
||||
|
3
1598_roundfind_sushu/Readme.md
Normal file
3
1598_roundfind_sushu/Readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# 标题
|
||||
|
||||
* 内容
|
1
1598_roundfind_sushu/doc/Readme.md
Normal file
1
1598_roundfind_sushu/doc/Readme.md
Normal file
@ -0,0 +1 @@
|
||||
#
|
BIN
1598_roundfind_sushu/doc/圆环上求素数III.pdf
Normal file
BIN
1598_roundfind_sushu/doc/圆环上求素数III.pdf
Normal file
Binary file not shown.
81
1598_roundfind_sushu/main.cpp
Normal file
81
1598_roundfind_sushu/main.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int n, k,a[8] = { 0, 1, 2, 3, 4, 5, 6, 7 },allans=0;
|
||||
bool ce[8]={0};
|
||||
bool pan(int n)
|
||||
{
|
||||
int len = sqrt(n);
|
||||
for (int i = 2; i <= len; i++) {
|
||||
if (n % i == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
void dg(int xian){
|
||||
if(xian>n){
|
||||
// for(int i=1;i<=n;i++){
|
||||
// cout<<a[i]<<" ";
|
||||
// }
|
||||
// cout<<endl;
|
||||
|
||||
int now = 0, zong = 1, ans = 0;
|
||||
for (int i = n - k + 2; i <= n; i++) {
|
||||
now *= 10;
|
||||
now += a[i];
|
||||
zong *= 10;
|
||||
}
|
||||
for (int i = 1; i <= n; i++) {
|
||||
now %= zong;
|
||||
now *= 10;
|
||||
now += a[i];
|
||||
ans += pan(now);
|
||||
}
|
||||
if(ans>allans){
|
||||
allans=ans;
|
||||
}
|
||||
}
|
||||
for(int i=2;i<=n;i++){
|
||||
if(ce[i]==0){
|
||||
a[xian]=i;
|
||||
ce[i]=1;
|
||||
dg(xian+1);
|
||||
ce[i]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int now = 0, zong = 1, ans = 0;
|
||||
cin >> n >> k;
|
||||
if (k == 1) {
|
||||
if (n == 1) {
|
||||
cout << "0" << endl
|
||||
<< "0";
|
||||
} else {
|
||||
int chu = 1;
|
||||
for (int i = 3; i <= n; i+=2) {
|
||||
chu++;
|
||||
}
|
||||
cout << chu << endl
|
||||
<< chu;
|
||||
}
|
||||
} else {
|
||||
for (int i = n - k + 2; i <= n; i++) {
|
||||
now *= 10;
|
||||
now += a[i];
|
||||
zong *= 10;
|
||||
}
|
||||
for (int i = 1; i <= n; i++) {
|
||||
now %= zong;
|
||||
now *= 10;
|
||||
now += a[i];
|
||||
ans += pan(now);
|
||||
}
|
||||
cout<<ans<<endl;
|
||||
dg(2);
|
||||
cout<<allans;
|
||||
}
|
||||
return 0;
|
||||
}
|
BIN
1598_roundfind_sushu/main.exe
Normal file
BIN
1598_roundfind_sushu/main.exe
Normal file
Binary file not shown.
1
1598_roundfind_sushu/test/in.txt
Normal file
1
1598_roundfind_sushu/test/in.txt
Normal file
@ -0,0 +1 @@
|
||||
7 1
|
1
1598_roundfind_sushu/test/in2.txt
Normal file
1
1598_roundfind_sushu/test/in2.txt
Normal file
@ -0,0 +1 @@
|
||||
7 3
|
1
1598_roundfind_sushu/test/in3.txt
Normal file
1
1598_roundfind_sushu/test/in3.txt
Normal file
@ -0,0 +1 @@
|
||||
6 4
|
21
1598_roundfind_sushu/test/out.txt
Normal file
21
1598_roundfind_sushu/test/out.txt
Normal file
@ -0,0 +1,21 @@
|
||||
## z:\Chao\src\1598_roundfind_sushu\test\in.txt
|
||||
2020/06/13 ÖÜÁù 9:56:47.43
|
||||
4
|
||||
4
|
||||
-----------------------------------------------
|
||||
Process exited after 180 ms with return value 0
|
||||
|
||||
## z:\Chao\src\1598_roundfind_sushu\test\in2.txt
|
||||
2020/06/13 ÖÜÁù 9:56:47.43
|
||||
0
|
||||
3
|
||||
-----------------------------------------------
|
||||
Process exited after 100 ms with return value 0
|
||||
|
||||
## z:\Chao\src\1598_roundfind_sushu\test\in3.txt
|
||||
2020/06/13 ÖÜÁù 9:56:47.43
|
||||
1
|
||||
2
|
||||
-----------------------------------------------
|
||||
Process exited after 90 ms with return value 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user