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. linux shell执行远程计算机上的命令或者脚本(ssh)

    大数据平台下经常建立设计多个节点的集群需要统一部署,这就设计到守护进程或者部署脚本在不同节点执行,如果能在master机器上,统一执行脚本,一次性启动整个集群的服务,感觉很nice.因为,分享如下内容 ...

  2. 利用AutoLayout适配滚动视图和表视图

    1.新增一个contentView,设置为与滑动视图的父视图等高等宽. 2.利用代码 if(_MyTestTableView.frame.size.height != _MyTestTableView ...

  3. iOS 9已下的获取APP进程信息

    - (NSDictionary *)getAppInfo:(NSString *)exec withBundleID:(NSString *)bundle { if ([exec isKindOfCl ...

  4. Vue的watch和computed属性

    Vue的watch属性 Vue的watch属性可以用来监听data属性中数据的变化 <!DOCTYPE html> <html> <head> <meta c ...

  5. windows server 2008 + IIS 7.5实现多用户FTP(多账号对应不同目录

    在windows server 2003 + IIS 6 的时候,就已经能实现多用户FTP的功能,不过设置有写繁琐,如果站点多的话,设置账号.权限这些东西都要搞很久.Windows server 20 ...

  6. python写excel

    例一,普通写入: # -*-coding: utf-8-*- import xlwt workbook = xlwt.Workbook() sheet = workbook.add_sheet('sh ...

  7. WebApi发送HTML表单数据:文件上传与多部分MIME

    5.3 Sending HTML Form Data5.3 发送HTML表单数据(2) 本文引自:http://www.cnblogs.com/r01cn/archive/2012/12/20/282 ...

  8. Rsync+Sersync同步

    Rsync+Sersync同步特点: (1):sersync可以记录下被监听目录中发生变化的(包括增加.删除.修改)具体某一个文件或某一个目录的名字:(2):rsync在同步的时候,只同步发生变化的这 ...

  9. (转)使用cygwin注意事项一

    原文出处:http://gotgit.readthedocs.io/en/latest/01-meet-git/050-install-on-windows-cygwin.html 在Windows下 ...

  10. AOP原理

    AOP(面向切面编程):扩展功能时不修改源代码,采用横向抽取机制 纵向抽取机制: 横向抽取机制: 第一种情况: 第二种情况: