A. Easy h-index

 #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <string>
#include <map>
#include <cmath>
#include <vector> #define Faster ios::sync_with_stdio(false),cin.tie(0)
#define Read freopen("in.txt","r",stdin),freopen("out.txt","w",stdout)
#define Close fclose(stdin),fclose(stdout)
const int maxn = *1e5 + ;
using namespace std;
const int MOD = 1e9+;
typedef long long ll; int a[maxn]; int main(){
Faster;
int n;
while(cin >> n){
for(int i = ;i <= n;i++){
cin >> a[i];
} int sum = ;
int h = n+;
while(sum < h){
sum += a[--h];
}
cout << h << endl;
}
return ;
}

B. Higher h-index

 #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <string>
#include <map>
#include <cmath>
#include <vector> #define Faster ios::sync_with_stdio(false),cin.tie(0)
#define Read freopen("in.txt","r",stdin),freopen("out.txt","w",stdout)
#define Close fclose(stdin),fclose(stdout)
const int maxn = *1e5 + ;
using namespace std;
const int MOD = 1e9+;
typedef long long ll; int a[maxn]; int main(){
Faster;
int n, a;
while(cin >> n >> a){
if(n < a)
cout << n << endl;
else{
int h = a + (n-a)/;
cout << h << endl;
}
}
return ;
}

F. Sorting

 #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <string>
#include <map>
#include <cmath>
#include <vector> #define Faster ios::sync_with_stdio(false),cin.tie(0)
#define Read freopen("in.txt","r",stdin),freopen("out.txt","w",stdout)
#define Close fclose(stdin),fclose(stdout)
const int maxn = 1e3+;
using namespace std;
const int MOD = 1e9+;
typedef long long ll; struct node
{
ll a,b,c;
int id;
}t[maxn]; bool cmp(node x, node y){
ll xx = x.a*y.c + x.b*y.c;
ll yy = y.a*x.c + y.b*x.c;
if(xx == yy)
return x.id < y.id;
return xx < yy;
} int main(){
Faster;
int n;
while(cin >> n){
for(int i = ;i < n;i++){
cin >> t[i].a >> t[i].b >> t[i].c;
t[i].id = i+;
}
sort(t,t+n,cmp);
for(int i = ;i < n;i++){
if(i == )
cout << t[i].id;
else
cout << " " << t[i].id;
}
cout << endl;
}
return ;
}

G. String Transformation

 #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <string>
#include <map>
#include <cmath>
#include <vector> #define Faster ios::sync_with_stdio(false),cin.tie(0)
#define Read freopen("in.txt","r",stdin),freopen("out.txt","w",stdout)
#define Close fclose(stdin),fclose(stdout)
const int maxn = 1e5 + ;
using namespace std;
const int MOD = 1e9+;
typedef long long ll; int main(){
Faster;
string s;
string t;
while(cin >> s >> t){
int sc, tc;
sc = tc = ;
for(char x:s){
if(x == 'c'){
sc++;
}
}
for(char x:t){
if(x == 'c'){
tc++;
}
}
if(sc != tc){
cout << "No" << endl;
continue;
}
int i, j, sa, sb, ta, tb;
i = j = sa = sb = ta = tb = ;
bool ok = true;
s += "c";
t += "c";
while(i < s.size() && j < t.size()){
while(s[i] != 'c' && i < s.size()){
if(s[i] == 'a')
sa++;
if(s[i] == 'b')
sb++;
i++;
}
while(t[j] != 'c' && j < t.size()){
if(t[j] == 'a')
ta++;
if(t[j] == 'b')
tb++;
j++;
}
if( sa% != ta% || sb% != tb%){
ok = false;
break;
}
if(s[i] == 'c'){
sa = sb = ;
i++;
}
if(t[j] == 'c'){
ta = tb = ;
j++;
}
}
if(ok)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return ;
}

K. 2018

 #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <string>
#include <map>
#include <cmath>
#include <vector> #define Faster ios::sync_with_stdio(false),cin.tie(0)
#define Read freopen("in.txt","r",stdin),freopen("out.txt","w",stdout)
#define Close fclose(stdin),fclose(stdout)
const int maxn = 1e4 + ;
using namespace std;
const int MOD = 1e9+;
typedef long long ll; int main(){
Faster;
ll a, b, c, d;
while(cin >> a >> b >> c >> d){
ll sum = ;
ll x = (b/ - (a-)/);
ll y = (d/ - (c-)/);
sum += x*(d-c+)+y*(b-a+)-x*y; //减去重复的部分 sum += (b/ - (a-)/ - x)*(d/ - (c-)/ - y);
sum += (d/ - (c-)/ - y)*(b/ - (a-)/ - x);
cout << sum << endl;
} return ;
}

2018ccpc_hn的更多相关文章

  1. 2018湘潭邀请赛 AFK题解 其他待补...

    A.HDU6276:Easy h-index Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/O ...

随机推荐

  1. Apache Thrift的简单介绍

    1.什么是Thrift thrift是一种可伸缩的跨语言服务的发展软件框架.它结合了功能强大的软件堆栈的代码生成引擎,以建设服务.不同开发语言开发的服务可以通过该框架实现通信. thrift是face ...

  2. 在oc中一些常用的宏定义总结

    1.打印CGRect,Size,Point #define NSLogRect(rect) NSLog(@"%s x:%.4f, y:%.4f, w:%.4f, h:%.4f", ...

  3. 浅淡!important对CSS的重要性

    SS中的!important是一个非常重要的属性,有时候发挥着非常大的作用,52CSS.com这方面的知识并不是非常多,我们看下面的文章,对它作比较感观的了解. 前几天写一些CSS代码的时候又难为我了 ...

  4. Hihocoder #1121 二分图一•二分图判定( bfs或者dfs搜索实现 搜索的过程中进行 节点标记 *【模板】)

    对于拿到的相亲情况表,我们不妨将其转化成一个图.将每一个人作为一个点(编号1..N),若两个人之间有一场相亲,则在对应的点之间连接一条无向边.(如下图) 因为相亲总是在男女之间进行的,所以每一条边的两 ...

  5. Bestcoder round 18----B题(一元三次方程确定区间的最大值(包含极值比较))

    Math Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tota ...

  6. Matlab小技巧之怎么复制汉字

    在我们复制Matlab到Word的过程中,经常会出现乱码的情况.这时候可以这么做. 1.复制Matlab代码. 2.新建一个txt文件,将代码粘贴到txt文件中. 3.复制txt文件中的代码到Word ...

  7. x264 --fullhelp

    >x264 --fullhelp x264 core: Syntax: x264 [options] -o outfile infile Infile can be raw (in which ...

  8. Java笔记(五)

    泛型:JDK1.5版本后出现的新特性.用于解决安全问题,是一个类型安全机制. 好处:将运行期间出现问题ClassCastException,转移到了编译时期.方便程序员解决问题,让运行时问题减少. 避 ...

  9. Axios 是一个基于 promise 的 HTTP 库,可以用在浏览器和 node.js 中。

    从浏览器中创建 XMLHttpRequests 从 node.js 创建 http 请求 支持 Promise API 拦截请求和响应 转换请求数据和响应数据 取消请求 自动转换 JSON 数据 客户 ...

  10. 配置哨兵监控Redis运行情况

    Redis的主从架构,如果master发现故障了,还得手动将slave切换成master继续服务,手动的方式容易造成失误,导致数据丢失,那Redis有没有一种机制可以在master和slave进行监控 ...