2018/8/15 qbxt 测试

期望得分:100;实际得分:50   不知道为什么写挂了,明明是个水题 T^T

思路:模拟

注意:如果用 char 类型存储的话,如果有'z' + 9 会爆char  但是我明明用的 string 啊

#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int n, m;
int len;
string s, ss; int main() {
scanf("%d%d", &n, &m);
cin >> s >> ss;
len = s.length();
for(int i = ; i < len; i++) {
s[i] += ss[i%m] - '';
if(s[i] > 'z') s[i] = s[i] - 'z' + 'a' - ;
}
cout << s << '\n';
return ;
}

考场代码

#include <cstdio>

#define next(i) ((i) == K-1 ? 0 : (i) + 1)

int main() {
int L, K;
scanf("%d%d", &L, &K);
char * s1 = new char[L + ];
char * s2 = new char[K + ]; scanf("%s%s", s1, s2); int j = ;
for (int i=; i<L; i++, j = (j==K- ? : j+))
s1[i] = ((s1[i] - 'a') + (s2[j] - '')) % + 'a'; puts(s1);
return ;
}

std

期望得分:100;实际得分:100

思路:将因为是完全平方数,所以这个数的因子在1~n中一定是出现了偶数次,道理显然,否则一定不会出现这样一个数。因此我们可以对于N分解质因数,用线性筛O(N)求出1~n的素数。求出素数后用N除以每个素数,开一个数组记录一下出现的次数,对于除出来的商,我们在判断一下能否在继续除以当前的素数,能继续除就继续加,道理显然。 
因此,如果数组中记录的数为奇数,就-1,这样就能保证以上偶数次的要求。

#include<iostream>
#include<cstdlib>
#include<cstdio>
#define LL long long
using namespace std;
const int maxn = ;
const LL mod = ;
bool not_prime[maxn];
int cnt;
LL n, ans=;
LL prime[maxn];
LL num[maxn]; LL ksm(LL a, LL b) {
if(b == ) return 1ll;
if(b == ) return a%mod;
LL tmp = ksm(a, b/)%mod;
if(b% == )
return ((tmp%mod)*(tmp%mod))%mod;
else
return ((((tmp%mod)*tmp)%mod)*(a%mod))%mod;
}
int main() {
scanf("%lld", &n);
not_prime[] = true;
for(LL i = ; i <= n; i++) {
if(!not_prime[i])
prime[++cnt] = i;
for(int j = ; j <= cnt; j++) {
if(prime[j]*i>n) break;
not_prime[prime[j]*i] = true;
if(i%prime[j] == ) break;
}
}
for(int i = ; i <= cnt; i++) {
LL aa = n;
while(aa != ) {
num[i] += aa/prime[i];
aa /= prime[i];
}
}
for(int i = ; i <= cnt; i++) {
if(num[i]% == )
ans = (ans*ksm(prime[i], num[i]))%mod;
else
ans = (ans*ksm(prime[i], num[i]-))%mod;
}
printf("%lld", ans);
return ;
}

考场代码

期望。。。不要爆零   实际。。。8分  qwq

思路:一看就是图论题,然后手动模拟了一下样例1,开始码代码。。发现后两个样例过不了我居然还以为样例错了,还去问老师。。傻的一批

正解:跑两边Floyd,第一次不考虑换马的情况求出最短路,第二次则要考虑换马 f[i][j] = min(f[i][k]+f[k][j]);

#include<algorithm>
#include<cstring>
#include<cstdio>
#include<queue>
#define M 10005
#define MAXN 0x3f3f3f
using namespace std;
queue<int> q;
int s, f;
int n, m, tot;
int e[M], v[M];
double dis[M], cap[M];
int to[M], net[M], head[M], vis[M]; void add(int u, int v, double w) {
to[++tot] = v; net[tot] = head[u]; head[u] = tot; cap[tot] = w;
}
void spfa(int x) {
for(int i = ; i <= n; i++)
dis[i] = 1.0*MAXN, vis[i] = ;
dis[x] = ; vis[x] = ; q.push(x);
while(!q.empty()) {
int y = q.front(); q.pop(); vis[y] = ;
for(int i = head[y]; i; i = net[i]) {
int t = to[i];
if(dis[t] > dis[y] + cap[i]) {
dis[t] = dis[y] + cap[i];
if(!vis[t]) vis[t] = , q.push(t);
}
}
}
// for(int i = 1; i <= n; i++) printf("%lf\n", dis[i]);
} int main() { scanf("%d%d", &n, &m);
for(int i = ; i <= n; i++)
scanf("%d%d", &e[i], &v[i]);
for(int i = ; i <= n; i++)
for(int j = ; j <= n; j++) {
int a;
scanf("%d", &a);
if(a == -) continue;
else if(e[i] < a) continue;
else {
double tmp = 1.0 * a / v[i];
add(i, j, tmp);
}
}
for(int i = ; i <= m; i++) {
scanf("%d%d", &s, &f);
spfa(s);
printf("%.6lf\n", dis[f]);
}
return ;
}

考场代码

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm> using namespace std; const int maxn=; int n,q,e[maxn],s[maxn]; double dis[maxn][maxn],dist[maxn][maxn]; int main()
{
int T=;
for (int t=;t<=T;t++)
{
scanf("%d%d",&n,&q);
for (int a=;a<=n;a++)
scanf("%d%d",&e[a],&s[a]);
for (int a=;a<=n;a++)
for (int b=;b<=n;b++)
{
scanf("%lf",&dis[a][b]);
if (dis[a][b]<) dis[a][b]=1e+;
if (a==b) dis[a][b]=;
}
for (int a=;a<=n;a++)
for (int b=;b<=n;b++)
for (int c=;c<=n;c++)
dis[b][c]=min(dis[b][c],dis[b][a]+dis[a][c]);
for (int a=;a<=n;a++)
for (int b=;b<=n;b++)
dist[a][b]=1e+;
for (int a=;a<=n;a++)
dist[a][a]=;
for (int a=;a<=n;a++)
for (int b=;b<=n;b++)
if (dis[a][b]<=e[a]) dist[a][b]=dis[a][b]/s[a];
for (int a=;a<=n;a++)
for (int b=;b<=n;b++)
for (int c=;c<=n;c++)
dist[b][c]=min(dist[b][c],dist[b][a]+dist[a][c]);
//printf("Case #%d:",t);
for (int a=;a<=q;a++)
{
int s,e;
scanf("%d%d",&s,&e);
printf("%.6lf\n",dist[s][e]);
}
} return ;
}

std

期望。。。不要爆零  实际。。骗分得到了10分   因为测试点数量比上一个少 qwq

思路:类似于滑动窗口,然后通过树状数组求解

树状数组似撒?能吃吗?qwq

骗分代码我就不展示了  捂脸

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm> using namespace std; #ifdef unix
#define LL "%lld"
#else
#define LL "%I64d"
#endif #define lb(x) ((x)&(-(x))) const int maxn=; int n,z[maxn],y[maxn],x[maxn]; long long k; bool cmp(int a,int b) {
return z[a]<z[b];
} void insert(int *z,int p,int d) {
for (; p<=n; p+=lb(p))
z[p]+=d;
} int query(int *z,int p) {
int ans=;
for (; p; p-=lb(p))
ans+=z[p];
return ans;
} int main() {
scanf("%d" LL,&n,&k);
for (int a=; a<=n; a++)
scanf("%d",&z[a]),y[a]=a;
sort(y+,y+n+,cmp);
x[y[]]=;
for (int a=; a<=n; a++)
if (z[y[a]]==z[y[a-]]) x[y[a]]=x[y[a-]];
else x[y[a]]=x[y[a-]]+;
for (int a=; a<=n; a++)
z[a]=x[a];
memset(x,,sizeof(x));
memset(y,,sizeof(y));
long long nowans=;
int p=n;
while (p>=) {
nowans+=query(y,z[p]-);
insert(y,z[p],);
p--;
}
p++;
long long ans=;
for (int a=; a<=n; a++) {
if (p==a) {
nowans-=a--query(x,z[p])+query(y,z[p]-);
insert(y,z[p],-);
p++;
}
nowans+=a--query(x,z[a])+query(y,z[a]-);
insert(x,z[a],);
while (nowans>k && p<=n) {
nowans-=a-query(x,z[p])+query(y,z[p]-);
insert(y,z[p],-);
p++;
}
if (nowans<=k) ans+=n-p+;
}
printf(LL "\n",ans); return ;
}

std

2018/8/15 qbxt 测试的更多相关文章

  1. 2018/8/21 qbxt测试

    2018/8/21 qbxt测试 期望得分:0? 实际得分:0 思路:manacher   会写模板但是不会用 qwq 听了某人的鬼话,直接输出0,然后就gg了 #include <cstdio ...

  2. 记2018/5/5 qbxt 测试

    记2018/5/5 qbxt 测试 竞赛时间: 2018 年 5 月 5 日 13:30-17:00 T1 一.maze(1s,512MB): 简单的迷宫问题:给定一个n*m的迷宫,.表示可以通过,# ...

  3. 记2018/4/29 qbxt 测试

    记 2018/4/29  qbxt 测试(提高基础班) 简单的 NOIP 模拟赛 竞赛时间: 2018 年 4 月 29 日 13:30-17:00 题目名称 乘法 求和 计数 输入文件名 mul.i ...

  4. Tencent Cloud Developers Conference(2018.12.15)

    时间:2018.12.15地点:北京朝阳悠唐皇冠假日酒店

  5. Lean Data Innovation Sharing Salon(2018.09.15)

    时间:2018.09.15地点:北京国华投资大厦

  6. JZOJ 5818. 【NOIP提高A组模拟2018.8.15】 做运动

    5818. [NOIP提高A组模拟2018.8.15] 做运动 (File IO): input:running.in output:running.out Time Limits: 2000 ms  ...

  7. WPF 使用鼠标拖动一个控件的实现[2018.7.15]

    原文:WPF 使用鼠标拖动一个控件的实现[2018.7.15] Q:已经把一个Shape和一个TextBlock组合起来放到了一个Grid中,现在想要实现用鼠标拖动这个Grid到任意位置的功能,如何做 ...

  8. WPF 在绘图控件(Shape)中添加文字 [2018.7.15]

    原文:WPF 在绘图控件(Shape)中添加文字 [2018.7.15] Q:使用Shape的子类Ellipse画一个圆,如何在圆中添加文字? A:Shape类中不包含Text属性.可使用Shape类 ...

  9. 2018中国科大自主测试-B卷部分试题

    数学部分 z = e^{\frac{2i\pi}{3}}, 求z^{2018}. \sin(2x) = \frac 35, 求\frac{\tan(x+15^{\circ})}{\tan(x-15^{ ...

随机推荐

  1. TCP/IP具体解释--TCP的分段和IP的分片

    写在前面: 分组能够发生在运输层和网络层.运输层中的TCP会分段,网络层中的IP会分片.IP层的分片很多其它的是为运输层的UDP服务的,因为TCP自己会避免IP的分片,所以使用TCP传输在IP层都不会 ...

  2. Codeforces 11B Jumping Jack(数学)

    B. Jumping Jack time limit per test 1 second memory limit per test 64 megabytes input standard input ...

  3. vue30-单一事件管理组件通信: vuex

    ------------------------------------------------------ 可以单一事件管理组件通信: vuex var Event=new Vue(); Event ...

  4. 10010序列检测器的三段式状态机实现(verilog)

    序列检测器是时序数字电路设计中经典的教学范例,夏宇闻的<verilog数字系统设计教程>一书中有这个例子,用verilog设计一个“10010”序列的检测器.看完后我觉得F和G两个状态多余 ...

  5. 1.Apache Axis配置文件WSDD详解

    转自:https://jyao.iteye.com/blog/1285516 1. Aapche Axis的Web Service Deployment Descriptor(WSDD)文件参考文档. ...

  6. MVC5发展历程,从MVC2谈起

    目前,MVC已经发布了5个版本,不包括一些临时的版本,为了更好的了解MVC5,知道MVC的发展历程是非常重要的.本篇随笔主要讲解3个版本的内容及其新特性. 1.MVC 2,发布日期:2010年3月 部 ...

  7. centos中mysql 安装以及配置,建库

    1.检测系统内部有没有安装其他的mysql数据库 rpm -qa | grep mysql 然后如果有的话删除这些mysql yum remove 查出来的所有名字 2.彻底删除系统中mysql的目录 ...

  8. Copying GC (Part two :Multi Space Copying GC)

    目录 近似深度优先搜索方法 Cheney的GC复制算法 前提 执行结果 多空间复制算法 multi_space_copying()函数 mark_or_copy() copy() 执行过程 优缺点 近 ...

  9. Swift学习笔记(4)--字符串及基本使用

    String是例如“hello, world”,“海贼王” 这样的有序的Character(字符)类型的值的集合,通过String类型来表示. Swift 的String类型与 Foundation  ...

  10. SPI总线工作模式

    一.SPI总线工作模式 SPI总线有四种工作模式,是由时钟极性选择(CPOL)和时钟相位选择(CPHA)决定的. CPOL = 0 ,SPI总线空闲为低电平,CPOL = 1, SPI总线空闲为高电平 ...