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. openstack之路:KVM/Libvirt 安装

    openstac是一个开源的计算机平台,利用虚拟化和底层存储服务提供云计算服务.openstack的基本是虚拟化技术.虚拟化技术采用的KVM.我们首先进行KVM软件的安装. 电脑配置: 内存:8G 硬 ...

  2. Ubuntu下声卡驱动解决方法alsa

    一.首先介绍一下什么是ALSA : Advanced Linux Sound Architecture 的简称为 ALSA ,译成中文的意思是先进的Linux声音架构(这是google翻译的):一谈到 ...

  3. ActivityManagerService服务线程启动源码分析【转】

    本文转载自:http://blog.csdn.net/yangwen123/article/details/8177702 Android系统服务线程都驻留在SystemServer进程中,由Syst ...

  4. jquery特效(4)—轮播图②(定时自动轮播)

    周末出去逛完街,就回公司好好地研究代码了,也算是把定时自动轮播程序写出来了,特意说明一下,这次的轮播图是在昨天随笔中jquery特效(3)—轮播图①(手动点击轮播)的基础上写出来的,也就是本次随笔展示 ...

  5. .net2.0 C# Json反序列化

    http://cjl20082002.blog.163.com/blog/static/120827332009511103457637/ 去:http://json.codeplex.com/下载  ...

  6. Android Developers - Training

    Recently I've been contemplating to create a new App with the true "Android Design",new An ...

  7. vue 表单验证省市县三联动

    <el-col :span="24"> <el-form-item label="所在地区" prop="region" ...

  8. bzoj 4398 福慧双修——二进制分组

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4398 如果枚举1号点走哪些点出去,就从那些点出发跑多源最短路即可.最短路不会重复经过一条边. ...

  9. ceph学习之pool

    pool是ceph存储数据时的逻辑分区,它起到namespace的作用.其他分布式存储系统,比如Mogilefs.Couchbase.Swift都有pool的概念,只是叫法不同.每个pool包含一定数 ...

  10. HDOJ-2045

    不容易系列之(3)—— LELE的RPG难题 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/O ...