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. SystemV和BSD的区别

    目前,Unix操作系统不管其内核如何,其操作风格上主要分为SystemV(目前一般采用其第4个版本SVR4)和BSD两种.其代表操作系统本别是Solaris和FreeBSD.当然,在SunOS4(So ...

  2. ffmpeg加文字水印并控制水印显示时间或显示周期

    #以下脚本保存成.sh文件运行,不会出现中文乱码问题 网上查到用enable关键字控制,实际是draw #加水印 水印位置由x,y,w,h来控制 #ffmpeg编译时需--enable-libfree ...

  3. ffmpeg遇到inttypes.h和UINT64_C

    http://blog.csdn.net/cll131421/article/details/7763657 编译过程:错误一:无法打开包括文件:“inttypes.h”: No such file ...

  4. html5--5-8 绘制圆/弧

    html5--5-8 绘制圆/弧 学习要点 掌握绘制圆弧的方法 矩形的绘制方法 rect(x,y,w,h)创建一个矩形 strokeRect(x,y,w,hx,y,w,h) 绘制矩形(无填充) fil ...

  5. poj分类解题报告索引

    图论 图论解题报告索引 DFS poj1321 - 棋盘问题 poj1416 - Shredding Company poj2676 - Sudoku poj2488 - A Knight's Jou ...

  6. !function(){}()和function(){}()区别

    控制台打印结果如下所示,接下来看一下具体运行,参考https://swordair.com/function-and-exclamation-mark/: 让一个函数声明语句变成了一个表达式

  7. Relocation POJ-2923

    题目链接 题目意思: 有 n 个货物,并且知道了每个货物的重量,每次用载重量分别为c1,c2的火车装载,问最少需要运送多少次可以将货物运完. 分析:本题可以用二进制枚举所有不冲突的方案,再来dp 一下 ...

  8. coeforces 665D D. Simple Subset(最大团orsb题)

    题目链接: D. Simple Subset time limit per test 1 second memory limit per test 256 megabytes input standa ...

  9. adb 读写模式 挂载文件系统

    删除需要把system挂载为读写,用到了这篇文章的这个命令: shell@android:/ # mount -o rw,remount yassf2 /system/   完整文章转自:http:/ ...

  10. 【CQ18高一暑假前挑战赛4】标程

    [二分或者STL] 二分: #include<bits/stdc++.h> using namespace std; ; int a[maxn]; int main() { ,pos; s ...