http://codeforces.com/gym/100735

D题 直接暴力枚举 感觉这道题数据有点问题 为什么要先排下序才能过?不懂。。

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <vector>
using namespace std;
const int maxn = ;
const int maxm = 1e4+;
const int inf = 0x3f3f3f3f;
const double epx = 1e-;
typedef long long ll;
int n,m;
ll a[maxn];
int main()
{
while(cin>>n)
{
for(int i=; i<=n; i++)
{
scanf("%I64d",&a[i]);
}
sort(a+,a++n);
int ans=;
int visit[maxn];
memset(visit,,sizeof(visit));
for(int i=;i<=n;i++)
{
for(int j=;j<=n;j++)
{ for(int k=;k<=n;k++)
{
if(visit[i]==&&visit[j]==&&visit[k]==&&i!=j&&j!=k&&i!=k&&a[i]+a[k]>a[j]&&a[i]+a[j]>a[k]&&a[j]+a[k]>a[i])
{
ans++;
visit[i]=,visit[j]=,visit[k]=;
}
}
}
}
printf("%d\n",ans);
}
}

E题  n*n的数字矩阵 横着 竖着 对角线 相加都等于val 可以推出 公式把矩阵   每行(或者每列)已有的数字加起来除以n-1=val 每行(每列)只有一个未知用val去减就好了。

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <vector>
using namespace std;
const int maxn = ;
const int maxm = 1e4+;
const int inf = 0x3f3f3f3f;
const double epx = 1e-;
typedef long long ll;
int n,m;
ll a[maxn][maxn];
int main()
{
cin>>n;
ll sum[maxn],zong=;
for(int i=; i<n; i++)
{
sum[i]=;
for(int j=; j<n; j++)
{
scanf("%I64d",&a[i][j]);
sum[i]+=a[i][j];
}
zong+=sum[i];
}
zong=zong/(n-);
for(int i=; i<n; i++)
{
for(int j=; j<n; j++)
{
ll x=a[i][j];
if(i==j)
x=zong-sum[i];
if(j==n-)
printf("%I64d\n",x);
else
printf("%I64d ",x);
}
}
}

G题 水题

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <vector>
using namespace std;
const int maxn = 1e5+;
const int maxm = 1e4+;
const int inf = 0x3f3f3f3f;
const double epx = 1e-;
typedef long long ll;
int n,m;
char a[maxn];
int main()
{
cin>>a;
int sum=,ans=;
int len=strlen(a);
for(int i=;i<len;i++)
{
if(a[i]=='')
ans++;
}
printf("%d\n",min(ans,len-ans));
}

H题 要用二分图最大匹配写  用dfs会T的很惨。

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <vector>
using namespace std;
const int maxn = ;
const int maxm = 1e4+;
const int inf = 0x3f3f3f3f;
const double epx = 1e-;
typedef long long ll;
int n;
char a[maxn][];
char s[maxn];
int len;
int visit[maxn];
int m[maxn][maxn];
int match[maxn];
bool found(int x)
{
for(int i=;i<=n;i++)
{
if(m[x][i]==&&visit[i]==)
{
visit[i]=;
if(match[i]==-||found(match[i]))
{
match[i]=x;
return true;
}
}
}
return false;
}
int main()
{
cin>>s>>n;
len=strlen(s);
memset(m,,sizeof(m));
memset(match,-,sizeof(match));
for(int i=; i<=n; i++)
{
for(int j=; j<; j++)
{
cin>>a[i][j];
for(int k=;k<len;k++)
{
if(a[i][j]==s[k])
m[k][i]=;
}
}
} int ans=;
for(int i=;i<len;i++)
{
memset(visit,,sizeof(visit));
if(found(i))
ans++;
}
if(ans==len)
printf("YES\n");
else
printf("NO\n");
}

I题 大数加法 Java大数类

import java.util.*;
import java.math.*;
public class Main
{
public static void main(String args[])
{
Scanner cin = new Scanner(System.in);
BigInteger a, b,c,a1,b1,c1;
while (cin.hasNext())
{
a = cin.nextBigInteger();
b = cin.nextBigInteger();
c = cin.nextBigInteger();
a1=a.add(a);b1=b.add(b);c1=c.add(c);
int flag=0;
if(a.add(b).compareTo(c)==0)
flag=1;
else if(a.add(c).compareTo(b)==0)
flag=1;
else if(b.add(c).compareTo(a)==0)
flag=1;
else if(a1.compareTo(b)==0)
flag=1;
else if(a1.compareTo(c)==0)
flag=1;
else if(b1.compareTo(a)==0)
flag=1;
else if(b1.compareTo(c)==0)
flag=1;
else if(c1.compareTo(b)==0)
flag=1;
else if(c1.compareTo(a)==0)
flag=1;
if(flag==1)
System.out.println("YES");
else
System.out.println("NO");
}
}
}

菜菜菜 就出了几道水题

codeforces Gym 100735 D、E、G、H、I的更多相关文章

  1. sed初理多行合并+sed之G、H、g、h使用+sed n/N使用说明

    转载:[shell]sed处理多行合并 - seyjs - 博客园 (cnblogs.com) 文件格式 table=t1 name owner address table=t2 id text co ...

  2. 2019年第十届蓝桥杯【C++省赛B组】D、E、G、H、I题解

    这场有几道题目思路,在之前比赛中遇到过 D. 数的分解 #枚举 题意 将\(2019\)分解成\(3\)个各不相同的正整数之和,并且每个正整数都不包含数字\(2\)和\(4\),一共有多少种分解方法? ...

  3. Python基础-生物信息:找出基因,生物学家使用字母A、C、T和G构成的字符串建模一个基因组。

    生物信息:找出基因,生物学家使用字母A.C.T和G构成的字符串建模一个基因组.一个基因是基因组的子串,它从三元组ATG后开始在三元组TAG.TAA或TGA之前结束.此外,基因字符串的长度是3的倍数,而 ...

  4. Codeforces GYM 100876 J - Buying roads 题解

    Codeforces GYM 100876 J - Buying roads 题解 才不是因为有了图床来测试一下呢,哼( 题意 给你\(N\)个点,\(M\)条带权边的无向图,选出\(K\)条边,使得 ...

  5. Codeforces Gym 101252D&&floyd判圈算法学习笔记

    一句话题意:x0=1,xi+1=(Axi+xi%B)%C,如果x序列中存在最早的两个相同的元素,输出第二次出现的位置,若在2e7内无解则输出-1. 题解:都不到100天就AFO了才来学这floyd判圈 ...

  6. HDU 5544 Ba Gua Zhen ( 2015 CCPC 南阳 C、DFS+时间戳搜独立回路、线性基 )

    题目链接 题意 : 给出一副简单图.要你找出一个回路.使得其路径上边权的异或和最大 分析 : 类似的题有 BZOJ 2115 对于这种异或最长路的题目(走过的边可以重复走) 答案必定是由一条简单路径( ...

  7. CodeForces Gym 100213F Counterfeit Money

    CodeForces Gym题目页面传送门 有\(1\)个\(n1\times m1\)的字符矩阵\(a\)和\(1\)个\(n2\times m2\)的字符矩阵\(b\),求\(a,b\)的最大公共 ...

  8. 【java基础学习一】int[]、Integer[]、String[] 排序( 正序、倒叙)、去重

    调用: //重复项有9.5.1.2 int[] ints = new int[]{9,4,7,8,2,5,1,6,2,5,9,1}; arrayIntTest(ints); ///////////// ...

  9. Windows网络驱动、NDIS驱动(微端口驱动、中间层驱动、协议驱动)、TDI驱动(网络传输层过滤)、WFP(Windows Filtering Platform)

    catalog . 引言 . Windows 2000网络结构和OSI模型 . NDIS驱动 . NDIS微端口驱动编程实例 . NDIS中间层驱动编程实例 . NDIS协议层驱动编程实例 . TDI ...

随机推荐

  1. Ajax记录

    Ajax简介 在传统的Web应用中,每次请求服务器都会生成新的页面,用户在提交请求后,总是要等待服务器的相应.如果前一个请求没有得到相应,则后一个请求就不能发送.由于这是一种独占式的请求,因此如果服务 ...

  2. 浅谈CSS中的定位知识

    1,静态定位(static) 表示按照正常定位方案,元素盒按照在文档流中出现的顺序依次格式化: 2,相对定位(relative) 将移动元素盒,但是它在文档流中的原始空间会保留下来: 相对定位元素有如 ...

  3. 【Lucene】实现全文索引

    2. Lucene 实现全文检索的流程2.1.索引和搜索流程图 绿色表示索引过程,对要搜索的原始内容进行索引构建一个索引库,索引过程包括:确定原始内容即要搜索的内容 -> 采集文档 -> ...

  4. CREATE OPERATOR CLASS - 定义一个新的操作符类

    SYNOPSIS CREATE OPERATOR CLASS name [ DEFAULT ] FOR TYPE data_type USING index_method AS { OPERATOR ...

  5. windos快捷键

    F1帮助 F2改名 F3搜索 F4地址 F5刷新 F6切换 F10菜单 CTRL+A全选 CTRL+C复制 CTRL+X剪切 CTRL+V粘贴 CTRL+Z撤消 CTRL+O打开 SHIFT+DELE ...

  6. call, apply, bind 区别

    #call, apply, bind 区别及模拟实现call apply bind 三者都可以用来改变this的指向,但是在用法上略有不同  首先说一下call和apply的区别 call和apply ...

  7. Java基础(十四)--装箱、拆箱详解

    Java中基本数据类型都有相对应的包装类 什么是装箱?什么是拆箱? 在Java SE5之前,Integer是这样初始化的 Integer i = new Integer(10); 而在从Java SE ...

  8. maven release插件将一版本发布到仓库中时Return code is: 401, ReasonPhrase:Unauthorized

    需要在maven的setting.xml中配置servers.server节点,其值为nexus的对应的repository的id以及用户名及密码 <servers> <server ...

  9. Duplicate fragment name ERROR Jetty Maven Plugin

    http://stackoverflow.com/questions/5802096/duplicate-fragment-name-error-jetty-maven-plugin 4down vo ...

  10. Ubuntu下systemd服务的配置

    1. 在/lib/systemd/system目录下创建服务启动脚本testservice.service 2. 文件内容如下: [Unit] Description=TestService [Ser ...