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. mysql 判断字符串是否为其他字符串的子集

    1.mysql 提供单个用逗号隔开判断某个字符串是否包含在其他字符串的之内:FIND_IN_SET('需要匹配的字符串','源字符串'); demo: select FIND_IN_SET('111' ...

  2. 4 Visual Effects 视觉效果 读书笔记 第四章

    4   Visual Effects    视觉效果        读书笔记 第四章 Well, circles and ovals are good, but how about drawing r ...

  3. NOT IN、NOT EXISTS的相关子查询改用LEFT JOIN--sql2000性能优化

    参考文章:SQL SERVER性能优化综述(很好的总结,不要错过哦) 数据库:系统数据库 子查询的用法 子查询是一个 SELECT 查询,它嵌套在 SELECT.INSERT.UPDATE.DELET ...

  4. Katalon Studio 安装 配置 简单使用

    本教程只针对Katalon Studio进行演示操作. 一.下载 Katalon 官网下载地址:https://www.katalon.com/download/ (需要注册账号) 二.解压.配置 直 ...

  5. jQuery动画处理

    $(selector).hide(speed,callback);隐藏 $(selector).show(speed,callback);显示 $(selector).toggle(speed,cal ...

  6. 洛谷 P2341 [HAOI2006]受欢迎的牛

    题目描述 每头奶牛都梦想成为牛棚里的明星.被所有奶牛喜欢的奶牛就是一头明星奶牛.所有奶 牛都是自恋狂,每头奶牛总是喜欢自己的.奶牛之间的“喜欢”是可以传递的——如果A喜 欢B,B喜欢C,那么A也喜欢C ...

  7. leetcode_486. Predict the Winner

    https://leetcode.com/problems/predict-the-winner/ 题目描述:给定一个非负的积分数组,玩家1可以从数组两端任取一个积分,接着玩家2执行同样的操作,直至积 ...

  8. JavaSE-13 内部类

    学习要点 内部类的定义 内部类的应用 内部类 定义 Java的一个类中包含着另一类. A类和B类是C类的外部类.B类是C类的外部类.A类也称为顶层类. 如何使用内部类 public class MyF ...

  9. PowerPoint幻灯片手动翻页设置技巧

    步骤: 幻灯片放映>设置幻灯片放映>手动

  10. HTML location 用法(获取当前URL)

    Location 对象 Location 对象包含有关当前 URL 的信息. Location 对象是 Window 对象的一个部分,可通过 window.location 属性来访问. 属性 loc ...