自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(34)
  • 收藏
  • 关注

原创 01背包1.28.补好思路

思路:和1.24的摔破储钱

2019-02-03 17:19:26 81

转载 1.26B补好思路

思路:定义temp这个数组对表中可能出现的组合进行一一表示,例如temp[1][1][1]=a[1][1],而temp[1][1][n]=a[1][1]+a[1][2]+到a[1][n],temp[1][n][n]=a[n][1]+a[n][2]+到a[n][n],容易看出temp数组随着k,i,j的不同,可以取各种组合。从而找到最大值。#include<stdio.h>#in...

2019-02-03 10:49:05 80

转载 1.21I补好思路

思路:列方程求解,易知A是B的倍数所以(A/B)相当于k(k>0&&k<9973),利用此可建立一个循环,(B % 9973)*i=A,除于9973得到n,此时减去n就是0;故满足该条件时可以求得该值。#include<iostream>#include<stdio.h>using namespace std; int main(){...

2019-01-30 10:22:17 97

转载 1.26C龟兔赛跑补好思路

思路标记在注释里# include <stdio.h># include <string.h># include <algorithm>//调用最小值函数。using namespace std;double dp[102], a[102];int main(){    double tmp, l, c, t, v1, v2, v3;    ...

2019-01-30 10:19:26 112

转载 第二次周赛E和F补好思路

E#include<stdio.h>int main(){    int m,n,i,temp,sum1,sum2;    while(~scanf("%d%d",&m,&n))    {sum1=sum2=0;    if(m>n)//交换值满足m<n.    {temp=m;m=n;n=temp;}    for(i=m;i<=...

2019-01-30 10:15:57 75

原创 青铜第二次周赛水仙花数补好思路

思路:求出总的水仙花数,再一一进行判断。#include<iostream>#include<cmath>using namespace std;int main(){    int l,r;    while(cin >> l >> r)    {        int count = 0;        for(int i=...

2019-01-30 10:11:45 79

转载 第一次周赛暴力补好思路

#include <bits/stdc++.h>using namespace std;int a[8005], n;int Solve(int pos){    // c[i]表示区间[i,pos-1](i<pos)或区间[pos+1,i](i>pos)中,    // 比a[pos]大的数的个数减去比a[pos]的数小的个数    int c[800...

2019-01-30 10:05:56 75

转载 第一次周赛贪心思想和汉诺塔补好思路

思路:只需要满足等分,或者切出一块大小为2的就可以1#include <bits/stdc++.h>using namespace std;int main(){    int n;    while(~scanf("%d", &n))    {        if((n % 2 == 0) && (n != 2))        { ...

2019-01-30 10:03:32 83

转载 **1.27C基因相似补好思路(难)

思路:通过数组统计不同的基因组合所对应的值,然后定义两个不计长度的vector数组用于储存不同的基因型。(所对应的类型组合对应表格。)然后定义一个函数进行递归调用,用于判断可能出现的可能型组合,输出最大值即为所需要的基因型形似度。然后注释解释代码作用。#include <iostream>#include <algorithm>#include <string...

2019-01-30 10:00:22 72

转载 1.28B

#include<iostream>#include<vector>using namespace std;const int maxn=105;vector<int>G[maxn];int n,m,v[maxn],Max,p[maxn],ans[maxn];bool vis[maxn];void dfs(int d,int va){    ...

2019-01-29 00:42:00 69

转载 1.28A补好思路

思路:在注释中标出。#include<cstdio>#include <cstring>#include<cmath>#include<iostream>#include<algorithm>#include<vector>#include <map>using namespace std;in

2019-01-29 00:39:00 71

转载 1.27B大理石补好思路

思路:属于多重背包问题,应该利用多重背包模板进行解题。#include <iostream>#include<algorithm>#include <stdio.h>#define max(a,b) a>b?a:b;using namespace std;int dp[70000], bag;void ZeroOnePack(int w, ...

2019-01-29 00:36:49 71

转载 1.26C

#include<stdio.h>#include<algorithm>using namespace std;double l=0xfffff;//double min(double a,double b)//{//       if(a<b)//       return a;//       else//       return b;//}...

2019-01-29 00:34:50 71

原创 1.24B补好思路

思路:利用b[u]数组进行判断,若出现相同的字母则只会计算一次,对在字母范围内出现的字母进行判断。#include<iostream>#include<stdio.h>#include<algorithm>using namespace std; int main(){    char a[1000];    gets_s(a);    i...

2019-01-29 00:27:35 76

转载 1.24D01背包储钱

思路:完全背包。补充在注释中。  #include<iostream>  #include<stdio.h>#include<algorithm>using namespace std;int f[10010] = { 0 };int main(){    int E, F, m, N, T, p[1000], w[1000];    cin...

2019-01-29 00:25:32 80

转载 1.23B

 namespace{     int GCD(int a, int b)    {        if (1 == a || b == 1) return 1;        while (b)        {            int t = b;            b = a%b;            a = t;        }        retur...

2019-01-29 00:23:20 92

转载 1.22B

#include<iostream>#include<string>using namespace std;int main(){   char a[101],b[101];    int c;    cin>>a>>b;    c=strlen(a);    for(int i=0;i<c;i++)        {if(a...

2019-01-29 00:20:15 77

原创 1.21B补好思路

思路:寻找不同的n(奇数个或者偶数个)所对应不同位置的数的规律,再用函数表达式表示出来。#include<iostream>using namespace std;int main(){    long long  n, k,i;    cin >> n >> k;    if (n % 2){        if (k <= n / 2 ...

2019-01-29 00:16:02 79

原创 1.20B补好思路

思路:寻找规律,利用递归进行求解。(n-4)/2可以通过十个数进行发现。#include <iostream>#include <stdio.h>#include <string.h>using namespace std; int get(int n){    if(n <= 5) return n;    else return g...

2019-01-29 00:11:49 79

原创 1.19D补好思路

思路:依题意可知奇数偶数有两种可能出现的情况,为了打出复合数,可运用分段函数。#include<iostream>#include<algorithm>#include<string>#include<cmath>using namespace std;int main(){    int n;    scanf("%d", &am...

2019-01-28 18:29:50 67

原创 1.19C

#include<iostream>#include<cstring>using namespace std;int main(){    int n,m;    scanf("%d %d",&n,&m);    if(m<n)    {        n=m;    }    if(n%2!=0)    {        p...

2019-01-28 18:27:48 66

转载 1.19B

#include <string>#include <iostream>using namespace std;void Dubstep(){    string s;    cin>>s;    string rs;    bool wordSpace = false;    for (unsigned i = 0; i < s.si...

2019-01-28 18:25:37 90

原创 1.19A补好思路

思路:对n个数进行规律判断,容易找到奇数个和偶数个所对应的规律#include<iostream>using namespace std;int main(){    long long int n,ans;    scanf("%lld",&n);    if(n%2==0)    {        ans=n/2;    }    else    {...

2019-01-28 18:23:41 75

转载 1.18D补好思路

思路:只有三个未知数,进行符号组合确定可能出现的可能性,再进行最大值比较。注意最大值函数每次只能比较两个。#include <cstdio>#include <algorithm>using namespace std;int max6(int a, int b, int c, int d, int e, int f){    return max(max(m...

2019-01-28 17:52:26 93

原创 1.18C补好思路

思路:利用I进行搜索计算,如果满足a[i]>=a[i-1],就进行I++,如果中途断掉就会有I=1,重新赋值。#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>#include <cmath>using namespa...

2019-01-28 17:35:48 69

原创 1.18B补好思路

思路:定义一个b[i]数组,分别对应储存1,2,3,4对应号数,然后运用 if (a[i] != i + 1)进行判断,如果相等说明礼物自己送给自己,不等则b[a[i] - 1] = i + 1,a[i] - 1相当于给的人的数减一刚好放在b数组里面就是这个人位置,然后i+1求出他给的这个人。#include<iostream>using namespace std;int m...

2019-01-28 17:27:16 60

原创 1.18A补好思路

思路:定义两个字符串进行比较,再运用flag进行判断,遇到这种判断问题可以运用flag还有if语句。#include<iostream>#include<string>using namespace std;int main(){    string a, b;    cin >> a >> b;    if (a.length()...

2019-01-28 17:00:12 74

转载 1.17D补好思路

 思路补充在注释里.#include <iostream>#include <algorithm>#include <stdio.h>using namespace std;int q[1000],p[1000],num[1000];int fmin(int a,int b){    if(a<b)    return a;   ...

2019-01-28 15:30:34 68

原创 1.17B补好思路

#include <iostream>#include<cstdio>#include<cstring>#include<cmath>using namespace std;int main(){    int n, i;    int sum1, sum2, sum3;    int a[101], b[101], c[101]...

2019-01-27 21:39:00 76

原创 1.17A补好思路

#include<iostream>#include<string>using namespace std;int main(){    int num, t;    cin >> num >> t;    string a;    a = "/n";//此处是为了将cin输入删除,使getline可以获得一个字符串;    get...

2019-01-27 21:17:59 75

原创 第六题

#includeusing namespace std;int main(){ char *a = new char[3]; cin >> a; cout << endl; char *b = new char[3]; cin >> b; cout << endl;&am

2018-12-07 21:11:43 155

原创 第四题

#include using namespace std;int main(){    int a,b;    while(cin >> a >> b)   {      &nbsp

2018-12-07 21:08:46 117

原创 第三题

#includeusing namespace std;int main(){ int n, i; cout << “The number of stones:” << endl; cin >> n; char *stone = NULL, *p; stone = new char[n];&nb...

2018-12-07 21:07:22 76

原创 第一题

#includeusing namespace std;int main(){char *letter = new char[100];char *print = new char[100];char exp[] = { ‘a’,‘e’,‘i’,‘o’,‘u’,‘y’,‘A’,‘E’,‘I’,‘O’,‘U’,‘Y’ };gets_s(letter, 100);int len1;f...

2018-12-07 21:04:32 79

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除