- 博客(18)
- 收藏
- 关注
原创 布线的问题
public class BuXian { private static int n; private static int[][] conn; private static int[] x,bestx; private static int bestd; private static int MAX = 100000; public static void main(String[] args){ Scanner input = ne...
2021-11-17 13:21:17
159
原创 n皇后问题
#include<iostream>#include<algorithm>#include<cmath>using namespace std;const int N=30;int x[N];int sum;int a[N][N];int c=1;bool flag = false;bool attack(int t){ for (int i=1;i<t;i++) if((abs(t-i)==abs(x[i]-x[t]...
2021-11-17 13:14:36
142
原创 最好的度问题
#include<iostream>#include<algorithm>#include<string.h>#include<cmath>#define N 100using namespace std;int a[N];int mt[N];int bestTime=100000;int n,k;void dfs(int t){ if(t>=n){ int maxTime=mt[0]; for(int i...
2021-11-17 13:13:34
149
原创 原排列问题
#include<iostream>#include<algorithm>using namespace std;int Min=100000;int sum=0;int a[100][100]; void dfs(int c,int n,int b[]){ if(c>=n){ Min=min(sum,Min); return ; } for(int i=0;i<n;i++){ ...
2021-11-17 13:12:21
186
原创 工作分配问题
#include<iostream>#include<algorithm>#include<cmath>using namespace std;const int N=0x3f3f3f;int n;double b,c,tmp;double Min=1000000;double x[N],r[N];void dfs(int t){ if(t>n) { double low=0,high=0; for (int i=1;i&...
2021-11-17 13:11:33
97
原创 2021-11-13硬币找钱问题
#include <iostream>#include <fstream>#include <algorithm>using namespace std;int Coins[6]; int CoinNum = 0; int Pay; in...
2021-11-13 13:21:47
403
原创 找钱问问题
#include <iostream>#include <fstream>#include <algorithm>using namespace std;int Coins[6]; // 各面值硬币数int CoinNum = 0; // 需要的最少硬币数int Pay; ...
2021-11-10 13:33:52
185
原创 taohui
#include<iostream>#include<cstring>#include<map>using namespace std;#define INF 0x3f3f3f3f#define MAX 45double path[MAX][MAX];map<string,int>ratemap;bool Floyd(int n){ for(int k=0;k<n;k++){ for(int i=0;i<...
2021-11-10 13:31:37
122
原创 最优合并问题
#include<bits/stdc++.h>using namespace std;bool cmp(int a,int b) { return a>b;}int MaxMerge(int a[],int k) { int max=0; for(int i=0; i<k-1; i++) { sort(a+i,a+k,cmp);//降序排列 只对后面还没有操作的元素进行重新排序 a[i+1]=a[i]+a[i+1...
2021-11-10 13:09:24
304
原创 磁盘文件最优存储
#include <bits/stdc++.h>#define ll long longusing namespace std;int n,mid,i,sum;bool cmp(int a,int b){return a>b;}void strageSort(int n,int a[]){ int k=1; sort(a,a+n,cmp); mid=n/2; int b[n+1]; b[mid]=a[0]; for(i=1;i&l...
2021-11-10 13:00:26
458
原创 汽车加油问题
#include <iostream>using namespace std;int main() { int n,k; cin>>n>>k; int d[n]; int f[n]; for(int i=0;i<=k;i++){ f[i]=1; cin>>d[i]; } int num = 0; for(int i = 0;i <= k;i++) { ...
2021-11-10 12:59:31
317
原创 会场安排问题
#include <iostream>#include <algorithm>using namespace std;int main(){ int n, i; cin >> n; int b[n],e[n]; for (i = 0; i < n; i++) cin >> b[i] >> e[i]; sort(b,b+n); sort(e,e+n); i...
2021-11-10 12:58:16
110
原创 最小双人合作完成任务
#include <bits/stdc++.h>using namespace std;int timea = 0;int mint =99;// 0x3f3f3fint a[1024];int b[1024];int F[1024][1024];void solve(int n){ memset(F,0,sizeof(F)); for(int i = 1; i <= n; ++i) { for(int j=0; j <= ...
2021-11-03 13:20:32
651
原创 汽车加油行驶问题
#include <iostream>#define INF 100000;using namespace std; int main(){ int N,K,A,B,C; cin>>N>>K>>A>>B>>C; int a[N+1][N+1];//N*N的那个网格 for(int i=1;i<=N;++i) for(int j=1;j<=N;++j) ...
2021-11-03 13:00:17
106
原创 租界游艇问题
#include<iostream>using namespace std;int main(){ int n; cin>>n; int r[n][n]; for(int i=1;i<n;i++) for(int j=i+1;j<=n;j++) cin>>r[i][j]; int m[n+1][n+1]; for(int i=1;i<=n;i...
2021-11-03 12:55:53
104
原创 最少硬币问题
#include<iostream>#define INF 9999using namespace std;int dp[20002];int main(){ int n,m,i,j; cin>>n; int t[n],c[n]; for(int i=1; i<=n; i++) { cin>>t[i]>>c[i]; } cin>>m; for(int i...
2021-11-03 12:54:10
100
原创 最小m段和问题
#include<iostream>using namespace std;int dp[1000][1000] ; void calculate(int a[], int n, int m){ int mi; if(n == 0) { cout<<0; return; } for(int i=1; i<=n; i++){ dp[i][1] = ...
2021-11-03 12:53:18
134
原创 编辑距离问题
#include<iostream>#include<string>using namespace std;void Count(string A,string B,int lenA,int lenB){ int D[lenB+1][lenA+1]; int i,j; int a=0,b=0; for(i=0;i<=lenA;i++) { D[0][i]=i; } for(i=0;i<=len...
2021-11-03 12:52:03
85
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅