D:找到两个数 一个是另一个的整数倍(1也算)

因为N是600000 调和级数为ln(n+1) 算一下 可以直接爆

#include <bits/stdc++.h>
#include <cstring>
#include <iostream>
#include <algorithm>
#define foror(i,a,b) for(i=a;i<b;i++)
#define foror2(i,a,b) for(i=a;i>b;i--)
#define EPS 1.0e-8
#define PI acos(-1.0)
#define INF 3000000000
#define MOD 1000000009
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define lson o<<1, l, m
#define rson o<<1|1, m+1, r
//using ll = long long;
//using ull= unsigned long long;
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que;
typedef long long ll;
bool cmp(int x,int y){return x>y;}
int where[];
int visit[];
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
int n,k;
cin >> n >> k;
int ans1=,ans2=;
int t;
for(int i=;i<=k;i++)
{
scanf("%d",&t);
if(visit[t]!=) //==1
{
ans1=where[t];
ans2=i;
break;
}
visit[t]++;
where[t]=i;
}
if(ans1!=&&ans2!=)
{
printf("%d %d\n",ans1,ans2);
return ;
}
for(int i=;i<=n;i++)
for(int j=*i;j<=n;j+=i)
{
if(visit[i]!=&&visit[j]!=)
{
ans1=where[i];
ans2=where[j];
break;
}
}
if(ans1!=&&ans2!=)
{
printf("%d %d\n",ans1,ans2);
return ;
}
printf("0 0\n");
return ;
}

E:两个板之间的数之和是K的倍数?? 反正这么做过了

#include <bits/stdc++.h>
#include <cstring>
#include <iostream>
#include <algorithm>
#define foror(i,a,b) for(i=a;i<b;i++)
#define foror2(i,a,b) for(i=a;i>b;i--)
#define EPS 1.0e-8
#define PI acos(-1.0)
#define INF 3000000000
#define MOD 1000000009
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define lson o<<1, l, m
#define rson o<<1|1, m+1, r
//using ll = long long;
//using ull= unsigned long long;
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que;
typedef long long ll;
bool cmp(int x,int y){return x>y;}
char a[];
//(a1+an)*n/2;
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
int n,k;
cin >> n;
scanf("%s",a+);
//printf("%s\n",a+1);
int num=;
int len=strlen(a+);
//cout <<len<<endl;
int first=,last=;
int pop=;
for(int i=;i<=len&&pop!=;i++)
{
if(a[i]=='')
{
//TS;
for(int j=i;j<len;j+=n)
{
//cout << j<<endl;
if(a[j+]=='')
{
first=i;
last=j+;
pop=;
break;
}
}
}
}
if(first!=&&last!=)
{
printf("%d %d",first,last);
return ;
}
printf("0 0\n");
return ;
}

G:水

H:2*3的砖铺 N*M的地板 以前CF好像做过 直接判min(n,m)>=2&&max(n,m)>=3  然后n*m%6==0

证明的话 引用别人的:

乘积是6的倍数那就说明有因子2和3:

1)一边是2的倍数恰好另一边是3的倍数,这种情况下显然可行;

2)一边是6的倍数另一边不是2也不是3的倍数,那另一边肯定是奇数,为1的时候不行,设边为N=2a+1=2(a-1)+3,那前面就以2x3的形式放最后一个以3x2的形式放,由于一边为6的倍数那么就是一定可以放得下的

#include <bits/stdc++.h>
#include <cstring>
#include <iostream>
#include <algorithm>
#define foror(i,a,b) for(i=a;i<b;i++)
#define foror2(i,a,b) for(i=a;i>b;i--)
#define EPS 1.0e-8
#define PI acos(-1.0)
#define INF 3000000000
#define MOD 1000000009
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define lson o<<1, l, m
#define rson o<<1|1, m+1, r
//using ll = long long;
//using ull= unsigned long long;
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que;
typedef long long ll;
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
int k;
cin >> k;
while(k--)
{
ll n,m;
cin >> n >> m;
ll sum=n*m;
if(min(n,m)<||max(n,m)<)
{
cout<<"No"<<endl;
continue;
}
if(sum%==)
cout <<"Yes"<<endl;
else
cout <<"No"<<endl;
}
return ;
}

I:阅读理解 把最长的R B先连起来

#include <bits/stdc++.h>
#include <cstring>
#include <iostream>
#include <algorithm>
#define foror(i,a,b) for(i=a;i<b;i++)
#define foror2(i,a,b) for(i=a;i>b;i--)
#define EPS 1.0e-8
#define PI acos(-1.0)
#define INF 3000000000
#define MOD 1000000009
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define lson o<<1, l, m
#define rson o<<1|1, m+1, r
//using ll = long long;
//using ull= unsigned long long;
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que;
typedef long long ll;
int red[],blue[];
bool cmp(int x,int y){return x>y;}
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
int n;
while(scanf("%d",&n)==)
{
mem(red,);
mem(blue,);
int pop=;
int pop1=;
int number=;
int ans=;
char ch;
int j;
for(int i=;i<=n;i++)
{
cin >> j>>ch;
if(ch=='R')
{
red[++pop]=j;
}
else
{
blue[++pop1]=j;
}
}
sort(red+,red+pop+,cmp);
sort(blue+,blue+pop1+,cmp);
for(int i=;i<=min(pop,pop1);i++)
{
ans+=red[i]+blue[i]-;
}
cout <<ans<<endl;
}
return ;
}

J:按条件读取字符 组成词组 输出

#include <bits/stdc++.h>
#include <cstring>
#include <iostream>
#include <algorithm>
#define foror(i,a,b) for(i=a;i<b;i++)
#define foror2(i,a,b) for(i=a;i>b;i--)
#define EPS 1.0e-8
#define PI acos(-1.0)
#define INF 3000000000
#define MOD 1000000009
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define lson o<<1, l, m
#define rson o<<1|1, m+1, r
//using ll = long long;
//using ull= unsigned long long;
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que;
typedef long long ll;
//stack<string> a;
int pop=;
map<string,int> mp;
string strans;
int ans=;
char c[];
//(a1+an)*n/2;
void print()
{
for(map<string,int>::iterator it=mp.begin();it!=mp.end();it++)
{
if(it->second>ans)
{
strans=it->first;
ans=it->second;
}
}
cout << strans<<":"<<ans<<endl;
}
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
while(gets(c))
{
int len=strlen(c);
if(len==&&c[]=='#')
{
print();
mp.clear();
strans="";
ans=;
continue;
}
else
{
for(int i=;i<len;i++)
{
string start="";
if(c[i]>='a'&&c[i]<='z')
{
int cur=i;
while(c[cur]>='a'&&c[cur]<='z')
{
start+=c[cur];
cur++;
}
i=cur;
if(c[cur]==','||c[cur]=='\0')
continue;
start+=' ';
while(c[cur]==' ')
cur++;
while(c[cur]>='a'&&c[cur]<='z')
{
start+=c[cur];
cur++;
}
//cout <<"start="<<start<<" ";
//cout <<endl;
mp[start]++;
}
}
}
}
return ;
}

Summer training #4的更多相关文章

  1. hdu 4946 2014 Multi-University Training Contest 8

    Area of Mushroom Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  2. 2016 Multi-University Training Contests

    2016 Multi-University Training Contest 1 2016 Multi-University Training Contest 2 2016 Multi-Univers ...

  3. 2016 Multi-University Training Contest 2 D. Differencia

    Differencia Time Limit: 10000/10000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Tot ...

  4. 2016 Multi-University Training Contest 1 G. Rigid Frameworks

    Rigid Frameworks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  5. ACM: Gym 101047K Training with Phuket's larvae - 思维题

     Gym 101047K Training with Phuket's larvae Time Limit:2000MS     Memory Limit:65536KB     64bit IO F ...

  6. The Solution of UESTC 2016 Summer Training #1 Div.2 Problem C

    Link http://acm.hust.edu.cn/vjudge/contest/121539#problem/C Description standard input/output After ...

  7. 2012 Multi-University Training Contest 9 / hdu4389

    2012 Multi-University Training Contest 9 / hdu4389 打巨表,实为数位dp 还不太懂 先这样放着.. 对于打表,当然我们不能直接打,这里有技巧.我们可以 ...

  8. 2014 Multi-University Training Contest 9#11

    2014 Multi-University Training Contest 9#11 Killing MonstersTime Limit: 2000/1000 MS (Java/Others)   ...

  9. 2014 Multi-University Training Contest 9#6

    2014 Multi-University Training Contest 9#6 Fast Matrix CalculationTime Limit: 2000/1000 MS (Java/Oth ...

  10. 2016 Multi-University Training Contest 1

    8/11 2016 Multi-University Training Contest 1 官方题解 老年选手历险记 最小生成树+线性期望 A Abandoned country(BH) 题意: 1. ...

随机推荐

  1. JAVA实验报告及第七周总结

    JAVA第六周作业 实验报告五 第一题 1.设计一个类层次,定义一个抽象类--形状,其中包括有求形状的面积的抽象方法. 继承该抽象类定义三角型.矩形.圆. 分别创建一个三角形.矩形.圆存对象,将各类图 ...

  2. poj1155 TELE (树上分组背包)

    题目链接:https://vjudge.net/problem/POJ-1155 题意:给定一颗以1为根的边权树,有n个结点,其中m个叶子结点,每个叶子结点有一个价值.要求从m个叶子结点中选最多的结点 ...

  3. redis db0-15 的概念

    redis默认有db0~db15之多. redis有没有什么方法使不同的应用程序数据彼此分开同时又存储在相同的实例上呢?就相当于mysql数据库,不同的应用程序数据存储在不同的数据库下. redis下 ...

  4. /tmp/orbit-oracle/目录inode耗尽

    [root@iZ25zpeock2Z orbit-oracle]# cd /[root@iZ25zpeock2Z /]# du -cks * |sort -nr|head -n 20du: canno ...

  5. chrome xpath调试

  6. idea的配置文件------application.properties和application.yml

    当application.yml 和 application.properties 两个文件同时存在的时候,application.properties的优先级是高于application.yml的, ...

  7. linux用户和组 之 用户管理

    一. linux 用户和组的基本介绍 1.linux下 有三种用户: 1. root: 权限最大的. 2. 系统用户: UID小于1000的.系统服务管理用户,一般是不允许登录系统的.(比如mysql ...

  8. winform中如何在多线程中更新UI控件--ListView实时显示执行信息

    1.在winform中,所有对UI的操作,都得回到UI线程(主线程)上来,才不会报错 线程间操作无效: 从不是创建控件的线程访问它. 2.在winform中,允许通过Control.invoke对控件 ...

  9. RHEL8运维新利器--Cockpit使用方法

    在web浏览器中查看服务器并使用鼠标执行系统任务,很容易管理存储.配置网络和检查日志等操作. # 安装cockpit yum -y install cockpit # 启用cockpit system ...

  10. EasyUI_前台js_分页

    1.html: <table id="DataTb" title="客户信息" class="easyui-datagrid" sty ...