感想:

  今天三个人的状态比昨天计院校赛的状态要好很多,然而三个人都慢热体质导致签到题wa了很多发。最后虽然跟大家题数一样(6题),然而输在罚时。

  只能说,水题还是刷得少,看到签到都没灵感实在不应该。


题目链接:http://acm.zju.edu.cn/onlinejudge/showContestProblems.do?contestId=391

  A:简单贪心,按高度sort一下就好了,这里用优先队列处理

 #include <cstdio>
#include <queue>
#include <algorithm>
#include <functional> using namespace std; int M[], F[]; int main(void)
{
int T;
while (scanf("%d", &T) != EOF)
{
while (T--)
{
int n, m;
priority_queue <int, vector<int>, greater <int>> fu, fd, mu, md;
scanf("%d %d", &n, &m);
for (int i = ; i < n; i++)
{
scanf("%d", &M[i]);
}
for (int i = ; i < m; i++)
{
scanf("%d", &F[i]);
}
for (int i = ; i < n; i++)
{
int flag;
scanf("%d", &flag);
if (flag)
{
mu.push(M[i]);
}
else
{
md.push(M[i]);
}
}
for (int i = ; i < m; i++)
{
int flag;
scanf("%d", &flag);
if (flag)
{
fu.push(F[i]);
}
else
{
fd.push(F[i]);
}
}
int ans = ;
// fu <-> md
while (!fu.empty() && !md.empty())
{
if (fu.top() < md.top())
{
// printf("pop: %d %d\n", fu.top(), md.top());
fu.pop();
md.pop();
ans++;
}
else
{
// printf("pop: %d\n", md.top());
md.pop();
}
}
// fd <-> mu
while (!mu.empty() && !fd.empty())
{
if (mu.top() < fd.top())
{
// printf("pop: %d %d\n", mu.top(), fd.top());
mu.pop();
fd.pop();
ans++;
}
else
{
// printf("pop: %d\n", fd.top());
fd.pop();
}
}
printf("%d\n", ans);
}
}
return ;
}

  B:找规律,显然是不停把n除二加起来,高精就用java

 import java.util.*;
import java.lang.*;
import java.math.BigInteger; public class Main { public static void main(String[] args) {
Scanner cin=new Scanner(System.in);
while (cin.hasNextInt())
{
int t=cin.nextInt();
while (t-->0){
BigInteger ans=BigInteger.ZERO;
BigInteger x=cin.nextBigInteger();
while (!x.equals(BigInteger.ONE)){
x=x.divide(BigInteger.valueOf(2));
ans=ans.add(x);
}
System.out.println(ans);
}
}
}
}

  C:模拟

 #include <cstdio>

 char t[][];
bool vis[][]; const int p3[] = {, , , , , }; const int movement[][] =
{
{, }, // DOWN
{, }, // RIGHT
{-, }, // UP
{, -} // LEFT
}; void init(int n, int m)
{
for (int i = ; i < n; i++)
{
for (int j = ; j < m; j++)
{
vis[i][j] = false;
}
}
} int solve(void)
{
int ans = ;
int n, m;
int a, b;
long long int k;
scanf("%d %d", &n, &m);
scanf("%d %d %lld", &a, &b, &k);
a--;
b--;
char cmd[];
scanf(" %s", cmd);
init(n, m);
for (int i = ; i < n; i++)
{
scanf(" %s", t[i]);
for (int j = ; j < m; j++)
{
t[i][j] -= '';
}
}
while (k--)
{
int x = p3[] * t[a][b]
+ p3[] * t[a - ][b]
+ p3[] * t[a + ][b]
+ p3[] * t[a][b - ]
+ p3[] * t[a][b + ];
if (vis[a][b])
{
return ans;
}
vis[a][b] = true;
if (cmd[x] == 'D')
{
int na = a + movement[][], nb = b + movement[][];
if (t[na][nb] == ) return ans;
else a = na, b = nb;
}
else if (cmd[x] == 'R')
{
int na = a + movement[][], nb = b + movement[][];
if (t[na][nb] == ) return ans;
else a = na, b = nb;
}
else if (cmd[x] == 'U')
{
int na = a + movement[][], nb = b + movement[][];
if (t[na][nb] == ) return ans;
else a = na, b = nb;
}
else if (cmd[x] == 'L')
{
int na = a + movement[][], nb = b + movement[][];
if (t[na][nb] == ) return ans;
else a = na, b = nb;
}
else if (cmd[x] == 'P')
{
if (t[a][b] == )
{
t[a][b] = ;
ans++;
init(n, m);
}
}
else if (cmd[x] == 'I')
{
return ans;
}
}
return ans;
} int main(void)
{
int T;
while (scanf("%d", &T) != EOF)
{
while (T--)
{
printf("%d\n", solve());
}
}
return ;
}

  D:上一题的人工智能版,要你构造特定程序捡垃圾。方法是走回字形,比如我们选定顺时针方向走,那么当我们走到左边靠墙位置的时候,如果右手边有垃圾,那么我们往右走一格再继续往上走。如果走到地图中间位置(四周没垃圾)就往上走。如果机器人走了连续相同方向n次就让机器人“抖动”一下(属实人工智能调参)。然而cy他们队就是A了(神仙啊

  E:从右往左扫一次就好了,队友没开LL导致wa一发要批评

 #include <cstdio>

 long long int a[], b[];

 int main(void)
{
int T;
while (scanf("%d", &T) != EOF)
{
while (T--)
{
int n;
scanf("%d", &n);
for (int i = ; i < n; i++)
{
scanf("%lld", &a[i]);
}
for (int i = ; i < n; i++)
{
scanf("%lld", &b[i]);
}
bool flag = true;
for (int i = n - ; i >= ; i--)
{
if (b[i] >= a[i])
{
if (i)
{
b[i - ] += b[i] - a[i];
}
}
else
{
flag = false;
break;
}
}
printf(flag ? "Yes\n" : "No\n");
}
}
return ;
}

  F:神仙题

  G:非常简单的贪心

 #include <cstdio>
#include <queue>
#include <algorithm>
#include <functional> using namespace std; int M[], F[]; int main(void)
{
int T;
while (scanf("%d", &T) != EOF)
{
while (T--)
{
int n, k;
scanf("%d %d", &n, &k);
priority_queue <long long int> pos, neg;
for (int i = ; i < n; i++)
{
int tmp;
scanf("%d", &tmp);
if (tmp > )
{
pos.push(tmp);
}
else
{
neg.push(-tmp);
}
}
long long int ans = , maxn = ;
while (!pos.empty())
{
ans += * pos.top();
maxn = max(pos.top(), maxn);
int cnt = k - ;
pos.pop();
while (cnt-- && !pos.empty())
{
pos.pop();
}
}
while (!neg.empty())
{
ans += * neg.top();
maxn = max(neg.top(), maxn);
int cnt = k - ;
neg.pop();
while (cnt-- && !neg.empty())
{
neg.pop();
}
}
printf("%lld\n", ans - maxn);
}
}
return ;
}

  H:救公主,边双相关的题目(然而队友最后没撸出来)

   I:要求逆元的看不懂的题目

  J:签到(wa了7次,三个人都没睡醒。这里我马上想到了可以输出n×2和n×3,然而忘记特判n==1的情况……)

 #include<iostream>
#include<cstdio>
#include<cstdlib> using namespace std; typedef long long ll; ll read()
{
ll x = ; char c = getchar(); ll flag = ;
while (c < '' || c > '')
{
if (c == '-')
{
flag = -;
}
c = getchar();
}
while (c >= '' && c <= '')x = x * 10ll + c - '', c = getchar();
return x;
} int main()
{
ll T;
while (scanf("%lld", &T) == )
{
while (T--)
{
ll x;
x = read();
if (x % == )
{
printf("4 %lld\n", + x);
}
else
{
printf("15 %lld\n", + x);
}
}
} return ;
}

2019 The 19th Zhejiang University Programming Contest的更多相关文章

  1. The 19th Zhejiang University Programming Contest - H

    Princess Cjb is caught by Heltion again! Her knights Little Sub and Little Potato are going to Helti ...

  2. The 19th Zhejiang University Programming Contest Sponsored by TuSimple (Mirror) B"Even Number Theory"(找规律???)

    传送门 题意: 给出了三个新定义: E-prime : ∀ num ∈ E,不存在两个偶数a,b,使得 num=a*b;(简言之,num的一对因子不能全为偶数) E-prime factorizati ...

  3. The 19th Zhejiang University Programming Contest Sponsored by TuSimple (Mirror)

    http://acm.zju.edu.cn/onlinejudge/showContestProblems.do?contestId=391 A     Thanks, TuSimple! Time ...

  4. zoj 4020 The 18th Zhejiang University Programming Contest Sponsored by TuSimple - G Traffic Light(广搜)

    题目链接:The 18th Zhejiang University Programming Contest Sponsored by TuSimple - G Traffic Light 题解: 题意 ...

  5. The 16th Zhejiang University Programming Contest-

    Handshakes Time Limit: 2 Seconds      Memory Limit: 65536 KB Last week, n students participated in t ...

  6. The 15th Zhejiang University Programming Contest

    a  ZOJ 3860 求和大家不一样的那个数,签到,map水之 #include<cstdio> #include<map> using namespace std; map ...

  7. ZOJ3865:Superbot(BFS) The 15th Zhejiang University Programming Contest

    一个有几个小坑的bfs 题目很长,但并不复杂,大概总结起来有这么点. 有t组输入 每组输入n, m, p.表示一个n*m的地图,每p秒按键会右移一次(这个等会儿再讲). 然后是地图的输入.其中'@'为 ...

  8. Mergeable Stack 直接list内置函数。(152 - The 18th Zhejiang University Programming Contest Sponsored by TuSimple)

    题意:模拟栈,正常pop,push,多一个merge A B 形象地说就是就是将栈B堆到栈A上. 题解:直接用list 的pop_back,push_back,splice 模拟, 坑:用splice ...

  9. 152 - - G Traffic Light 搜索(The 18th Zhejiang University Programming Contest Sponsored by TuSimple )

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5738 题意 给你一个map 每个格子里有一个红绿灯,用0,1表示 ...

随机推荐

  1. JMeter 扩展JMeter插件获取更多监听器

    扩展Jmeter插件获取更多监听器 by:授客 QQ:1033553122 为了获取更多监听器,方便的监控系统及应用,有必要安装第三方插件. 插件下载地址: https://jmeter-plugin ...

  2. PHP开发APP接口学习笔记

    习要点概述1.APP接口简介 2.封装通信接口方法 3.核心技术 4.APP接口实例 服务器和客户端进行接口数据通信:服务器 -->数据库|缓存 -->调用接口 -->客户端 服务器 ...

  3. tkinter中combobox下拉选择控件(九)

    combobox控件,下拉菜单控件 combobox控件在tkinter中的ttk下 简单的实现下: import tkinter from tkinter import ttk # 导入ttk模块, ...

  4. Linux 查看对外开放端口

    备忘命令: netstat -anpt | grep 514 # 查看 rsyslog tcp 端口是否开放 保持更新,转载请注明出处.

  5. [MapReduce_add_2] MapReduce 实现年度最高气温统计

    0. 说明 编写 MapReduce 程序实现年度最高气温统计 1. 气温数据分析 气温数据样例如下: ++023450FM-+000599999V0202701N015919999999N00000 ...

  6. C# 生成强命名程序集并添加到GAC

    针对一些类库项目或用户控件项目(一般来说,这类项目最后编译生成的是一个或多个dll文件),在程序开发完成后,有时需要将开发的程序集(dll文件)安装部署到GAC(全局程序集缓存)中,以便其他的程序也可 ...

  7. Emmet快速编写代码

    Emmet快速编写代码 ★div → <div></div>, span → <span></span> ★CSS选择器 ​ 给标签指定id选择器 di ...

  8. 【PAT】B1072 开学寄语(20 分)

    代码注释应该很清晰 先存下违禁品,放到数组中,未使用map #include<cstdio> #include<string.h> int wupin[10],N,M; boo ...

  9. Java7/8 中 HashMap 和 ConcurrentHashMap的对比和分析

    大家可能平时用HashMap比较多,相对于ConcurrentHashMap 来说并不是很熟悉.ConcurrentHashMap 是 JDK 1.5 添加的新集合,用来保证线程安全性,提升 Map ...

  10. vue_02 开发过程中的问题记载

    1.package.json 运行 npm start 执行的是npm run  dev 实际上执行的是“dev” : node build/dev-server.js这一条 跑的是build目录下d ...