CF 937
A
#include <bits/stdc++.h>
#define PI acos(-1.0)
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
#define inf 1e9
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que; get min
const double eps = 1.0e-8;
typedef pair<int, int> pairint;
typedef long long ll;
typedef unsigned long long ull;
//const int maxn = 3e5 + 10;
const int maxm = ;
const int turn[][] = {{, }, { -, }, {, }, {, -}};
//priority_queue<int, vector<int>, less<int>> que;
//next_permutation
ll mod = 3e7;
int num[];
int main()
{
int n;
cin >> n;
int cur;
for (int i = ; i <= n; i++)
{
cin >> cur;
num[cur] = ;
}
int anser = ;
for (int i = ; i <= ; i++)
{
if (num[i])
{
anser++;
}
}
cout << anser << endl;
return ; }
B
#include <bits/stdc++.h>
#define PI acos(-1.0)
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
#define inf 1e9
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que; get min
const double eps = 1.0e-8;
typedef pair<int, int> pairint;
typedef long long ll;
typedef unsigned long long ull;
//const int maxn = 3e5 + 10;
const int maxm = ;
const int turn[][] = {{, }, { -, }, {, }, {, -}};
//priority_queue<int, vector<int>, less<int>> que;
//next_permutation
ll mod = 3e7;
ll p, y;
bool check(ll now)
{
for (int i = ; i * i <= now && i <= p; i++)
{
if (now % i == )
{
return ;
}
}
return ;
}
int main()
{
cin >> p >> y;
int flag = ;
for (int i = y; i >= p + ; i--)
{
if (check(i))
{
cout << i << endl;
flag = ;
break;
}
}
if (!flag)
{
cout << - << endl;
}
return ;
}
C
#include <bits/stdc++.h>
#define PI acos(-1.0)
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
#define inf 1e9
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que; get min
const double eps = 1.0e-10;
const double EPS = 1.0e-4;
typedef pair<int, int> pairint;
typedef long long ll;
typedef unsigned long long ull;
const int turn[][] = {{, }, { -, }, {, }, {, -}};
//priority_queue<int, vector<int>, less<int>> que;
//next_permutation
int main()
{
double k, d, t;
cin >> k >> d >> t;
ll k1 = k;
ll d1 = d;
double ans = ;
if (k1 % d1 == )
{
printf("%.1f\n", t);
return ;
}
else
{
double bei = (long long)(k / d) + 1.0;
//printf("bei: %.1f\n", bei);
double xunhuan = bei * d;
//printf("xunhuan: %.1f\n", xunhuan);
double ximie = xunhuan - k;
//printf("ximie: %.1f\n", ximie);
double once = k + ximie / 2.0;
//printf("once: %.1f\n", once);
double bei2 = (long long)(t / once);
//printf("bei2: %.1f\n", bei2);
double remain = t - once * bei2;
//printf("remain: %.1f\n", remain);
ans += bei2 * xunhuan;
//printf("ans: %.1f\n",ans);
if (remain <= k)
{
ans += remain;
}
else
{
ans += k + (remain - k) * 2.0;
}
printf("%.1f\n", ans);
}
}
D
anser[i][j][0]表示偶数步能到达 [1]表示奇数部能到达
每个点最多访问两次
#include <bits/stdc++.h>
#define PI acos(-1.0)
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
#define inf 1e9
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que; get min
const double eps = 1.0e-10;
const double EPS = 1.0e-4;
typedef pair<int, int> pairint;
typedef long long ll;
typedef unsigned long long ull;
//const int maxn = 3e5 + 10;
const int maxm = ;
const int turn[][] = {{, }, { -, }, {, }, {, -}};
//priority_queue<int, vector<int>, less<int>> que;
//next_permutation
ll mod = 3e7;
const int maxn = ;
int anser[][];
int visit[];
int flag = ;
int road[];
vector<int> pla[];
void dfs(int now, int x)
{
visit[now] = ;
anser[now][x % ] = ;
road[x] = now;
int to;
int len = pla[now].size();
if (len == && (x % == ))
{
cout << "Win" << endl;
for (int i = ; i <= x; i++)
{
cout << road[i] << " ";
}
exit();
}
else
{
for (int i = ; i < len; i++)
{
to = pla[now][i];
if (visit[to] == )
{
flag = ;
if (anser[to][(x + ) % ] == )
{
continue;
}
dfs(to, x + );
}
else
{
if (anser[to][(x + ) % ] == )
{
continue;
}
dfs(to, x + );
}
}
}
visit[now] = ;
}
int main()
{
for (int i = ; i <= ; i++)
{
for (int j = ; j <= ; j++)
{
anser[i][j] = -;
}
}
int n, m;
int num;
int to;
cin >> n >> m;
for (int i = ; i <= n; i++)
{
scanf("%d", &num);
for (int j = ; j <= num; j++)
{
scanf("%d", &to);
pla[i].pb(to);
}
}
int aim;
cin >> aim;
dfs(aim, );
if (flag)
{
cout << "Draw" << endl;
return ;
}
cout << "Lose" << endl;
}
CF 937的更多相关文章
- 【codeforces】【比赛题解】#937 CF Round #467 (Div. 2)
没有参加,但是之后几天打了哦,第三场AK的CF比赛. CF大扫荡计划正在稳步进行. [A]Olympiad 题意: 给\(n\)个人颁奖,要满足: 至少有一个人拿奖. 如果得分为\(x\)的有奖,那么 ...
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- cf Round 613
A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...
- ARC下OC对象和CF对象之间的桥接(bridge)
在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...
- [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现
1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...
- CF memsql Start[c]UP 2.0 A
CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...
- CF memsql Start[c]UP 2.0 B
CF memsql Start[c]UP 2.0 B B. Distributed Join time limit per test 1 second memory limit per test 25 ...
- CF #376 (Div. 2) C. dfs
1.CF #376 (Div. 2) C. Socks dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...
随机推荐
- spring session 加载的时候一些配置问题
启动springboot时候的错误信息: An attempt was made to call the method org.springframework.boot.autoconfigure.s ...
- Ping链路测试
https://help.aliyun.com/knowledge_detail/40573.html?spm=5176.2020520165.121.d519.4b4f7029sHzfmi#TRAC ...
- PDF to PNG to PDF
PDF to PNG to PDF PDF 2 PNG step 1, install PyMuPDF pip install pymupdf -i http://mirrors.aliyun.com ...
- docker中 devicemapper驱动挂载容器镜像文件
详解docker中容器devicemapper设备的挂载流程
- JDK1.7安装配置环境变量+图文说明Jmeter安装
Jmeter通常用于并发测试,本文介绍Jmeter工具的安装步骤. 工具/原料 WIN7 Jmeter安装包 JDK 一.安装JDK 1 [步骤一]安装jdk 1.下载jdk,到官网下载jdk ...
- maven 配置参数详解!
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- chrome 74 版本的chromedriver下载地址
微信扫二维码关注我的公众号,回复chromedriver 即可获取windows,liunx,mac版本最新selenium-chromedriver
- 递归算法之不用乘号的乘法——用位移实现乘法(dart语言实现)
前两天突发奇想,写一个乘法的实现,但不用乘号*.并测试一下性能如何.因此就有了下面的代码:(本文主要目的是为了玩递归和位移,因此仅限自然数) 首先,标准乘法: int commonMultiplica ...
- Vue.js系列:生命周期钩子
开发人员提供了一个Web开发人员可以在Vue.js应用程序的整个生命周期中使用的各种方法的讨论. 生命周期钩子是在Vue对象生命周期的某个阶段执行的已定义方法.从初始化开始到它被破坏时,对象都会遵循不 ...
- python+selenium上传文件——input标签
我们要区分出上传按钮的种类,大体上可以分为两种: 第一种普通上传:将本地文件路径作为一个值,放在input标签中,通过form表单将这个值提交给服务器: 第二种插件上传:是通过Flash.JavaSc ...