链接:https://codeforc.es/gym/102267

A. Picky Eater

直接比较

int main(){
int x ,y;
scanf("%d %d" ,&x ,&y);
if(x>=y){
return printf(""),;
}
else return printf(""),;
return ;
}

B. Primes

素数筛,log判断

int prime[maxn],num_prime = ;
int vis[maxn];
void is_prime(int N){
for(int i=;i<=N;i++){
if(!vis[i]){
prime[num_prime++] = i;
vis[i] = i;
}
for(int j=;j<num_prime&&i*prime[j]<=N;j++){
vis[i*prime[j]] = prime[j];
if(!(i%prime[j])){
break;
}
}
}
return;
}
int n;
int main(){
scanf("%d", &n);
is_prime(n);
for(int i = ; i < num_prime; i++){
int j = prime[i];
int p = lower_bound(prime,prime+num_prime,n-j)-prime;
if(prime[p]==n-j){
return printf("%d %d",j,n-j),;
} }
printf("-1");
return ;
}

C. Matryoshka Dolls

一个循环

int x,y;
int main(){
scanf("%d %d", &x, &y);
int ans = ;
while(x){
ans++;
x/=y;
}printf("%d",ans);
return ;
}

D. Robots Easy

12*12,直接rand乱跑

#include<iostream>
#include<cstdio>
#include<algorithm>
//#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<vector>
#include<map> #define fst first
#define sc second
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define lson l,mid,root<<1
#define rson mid+1,r,root<<1|1
#define lc root<<1
#define rc root<<1|1 using namespace std; typedef double db;
typedef long double ldb;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
typedef pair<ll,ll> PLL; const db eps = 1e-;
const int mod = ;
const int maxn = 2e6+;
const int maxm = 2e6+;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
//const db pi = acos(-1.0); int x,y;
int a[][];
vector<char>ans;
int dx,dy;
inline int Rand(){
static int seed = ;
return seed = (int)((((seed ^ ) + 19260817ll) * 19890604ll) % );
}
int main(){
int t;
scanf("%d", &t);
a[][]=a[][]=a[][]=a[][]=;
a[][]=a[][]=a[][]=;
a[][]=a[][]=a[][]=;
a[][]=a[][]=a[][]=a[][]=;
while(t--){
ans.clear();
scanf("%d %d" ,&x ,&y);
while(a[x][y]!=){
//printf("%d %d\n",x,y);
int op;
while(op=rand()%){
dx=dy=;
char ch;
if(op==){dx=-;ch='U';}
if(op==){dx=;ch='D';}
if(op==){dy=-;ch='L';}
if(op==){dy=;ch='R';}
if(op==)continue;
//printf(" %d\n",op);
if(x+dx>=&&x+dx<=&&y+dy>=&&y+dy<=){
if(a[x+dx][y+dy]==)continue;
x+=dx;y+=dy;
ans.pb(ch);
break;
}
else continue;
}
}
printf("%d\n",ans.size());
for(int i = ; i < (int)ans.size(); i++){
printf("%c",ans[i]);
}printf("\n"); }
return ;
}

H. Circle of Polygon

一个公式

double v,s;
int main(){
scanf("%lf %lf", &v, &s);
printf("%.9lf",1.0/2.0*pi*s*s/(1.0-cos(*pi/v))); return ;
}

I. Ultimate Army

左括号之后一定跟一个数,遇到左括号,下一个数的sup就是栈顶,遇到数字入栈,遇到右括号出栈

int n;
char a[maxn];
stack<int>s;
vector<int>v;
int ans[maxn];
int main(){
scanf("%d", &n);
scanf("%s",a+);
int len = strlen(a+);
int tmp = ;
int gao = ;
for(int i = ; i <= len; i++){
if(a[i]>=''&&a[i]<=''){
tmp*=;
tmp+=a[i]-'';
}
else{
if(tmp!=)v.pb(tmp);
tmp=;
}
if(a[i]=='(')v.pb(-);
else if(a[i]==')')v.pb(-);
}
for(int i = ; i < (int)v.size(); i++){
if(v[i]>){
if(gao)ans[v[i]]=s.top();
s.push(v[i]);
gao=;
}
else if(v[i]==-){
gao=;
}
else if(v[i]==-){
s.pop();
}
}
for(int i = ; i <= n; i++){
printf("%d ",ans[i]);
}
return ;
}

K. Birthday Puzzle

2^20暴力dfs维护答案即可

ll ans;
int n;
int a[maxn];
void dfs(int x, int now){
if(x==n+){
ans+=now;
return;
}
dfs(x+,now|a[x]);
dfs(x+,now);
}
int main(){
scanf("%d", &n);
for(int i = ; i <= n; i++){
scanf("%d", &a[i]);
}
dfs(,);
printf("%lld",ans);
return ;
}

The 2019 University of Jordan Collegiate Programming Contest的更多相关文章

  1. ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2018) Syria, Lattakia, Tishreen University, April, 30, 2018

    ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2018) Syr ...

  2. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Capture the Flag

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5503 The 12th Zhejiang Provincial ...

  3. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Team Formation

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5494 The 12th Zhejiang Provincial ...

  4. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Lunch Time

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5499 The 12th Zhejiang Provincial ...

  5. zoj The 12th Zhejiang Provincial Collegiate Programming Contest May Day Holiday

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5500 The 12th Zhejiang Provincial ...

  6. 140 - The 12th Zhejiang Provincial Collegiate Programming Contest(第二部分)

    Floor Function Time Limit: 10 Seconds      Memory Limit: 65536 KB a, b, c and d are all positive int ...

  7. 模拟赛小结:2017-2018 ACM-ICPC Nordic Collegiate Programming Contest (NCPC 2017)

    比赛链接:传送门 本场我们队过的题感觉算法都挺简单的,不知道为啥做的时候感觉没有很顺利. 封榜后7题,罚时1015.第一次模拟赛金,虽然是北欧的区域赛,但还是有点开心的. Problem B Best ...

  8. The 2015 China Collegiate Programming Contest A. Secrete Master Plan hdu5540

    Secrete Master Plan Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Othe ...

  9. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Beauty of Array

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5496 The 12th Zhejiang Provincial ...

随机推荐

  1. C#操作注册表(简单方便,兼容X32和X64)

    C#操作注册表(简单方便,兼容X32和X64) 大家好,我在这里给大家介绍本人实现的操作注册表的类,简单方便,兼容32位系统和64位系统. 一般大家用C#操作注册的方法是使用命名空间Microsoft ...

  2. 利用Tampermonkey(油猴)+ IDM 实现百度云盘大文件下载(IDM安装教程)

    关注微信公众号:“指尖创意” 在菜单干货专区软件目录里领取链接: tampermonkey插件是一个免费的浏览器扩展和最为流行的用户脚本管理器,拥有适用于 Chrome, Microsoft Edge ...

  3. [JavaScript设计模式]惰性单例模式

    惰性单例模式 之前介绍了JS中类的单例模式,这次我们讨论下单例模式的应用.在众多网站中,登录框的实现方式就是一个单例,点击一次就展示一次,所以我们可以在页面加载好的时候就创建一个登录框,点击页面上的登 ...

  4. infer 代码静态分析

    infer 代码静态分析 静态代码分析工具,主要是为了提高我们的代码质量. 通常,我们提高代码质量的方式是通过CodeReview,但是这个过程耗费的人工和时间往往较大.并且随着代码量的增加人肉检测起 ...

  5. Map2Shp软件字符编码解决方案——彻底杜绝Shape格式乱码

    在使用Shape文件时,如果里面有中文属性信息时,经常会遇到属性信息变为乱码.尤其是ArcGIS10.2.1之后,Esri改变了软件的默认字符编码规则,打开之前保存的Shapefile文件,总会不时遇 ...

  6. .NET使用FastDBF写入DBF

    FastDBF源代码地址:https://github.com/SocialExplorer/FastDBF 第一步在解决方案中新建一个类库的项目:取名为SocialExplorer.FastDBF ...

  7. JDBC超时设置【转】

    恰当的JDBC超时设置能够有效地减少服务失效的时间.本文将对数据库的各种超时设置及其设置方法做介绍. 真实案例:应用服务器在遭到DDos攻击后无法响应 在遭到DDos攻击后,整个服务都垮掉了.由于第四 ...

  8. 图解kubernetes调度器抢占流程与算法设计

    抢占调度是分布式调度中一种常见的设计,其核心目标是当不能为高优先级的任务分配资源的时候,会通过抢占低优先级的任务来进行高优先级的调度,本文主要学习k8s的抢占调度以及里面的一些有趣的算法 1. 抢占调 ...

  9. python小知识点总结

    小知识点总结 1.python2和python3的区别   python2 python3 默认编码 ascii utf-8 input() raw_input() input() print 可以不 ...

  10. 生产者消费者代码学习,Producer_Consuner

    使用BlockingQuery实现生产者者消费者:考虑并发,解耦. 生产者消费者模式是面向过程的设计模式. 生产者制造数据   ------> 生产者把数据放入缓冲区  -------> ...