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)如果需 ...
随机推荐
- 使用js如何获取treeview控件的当前选中的节点
var selectedNodeID = theForm.elements["<%=treeView1.ClientID%>_SelectedNode"].value; ...
- Selenium学习之==>ActionChainsApi接口详解
ActionChains UI自动化测试过程中,经常遇到那种,需要鼠标悬浮后,要操作的才会元素出现的这种场景,那么我们就要模拟鼠标悬浮到某一个位置,做一系列的连贯操作,Selenium给我们提供了Ac ...
- 中国MOOC_零基础学Java语言_第3周 循环_2数字特征值
2 数字特征值(5分) 题目内容: 对数字求特征值是常用的编码算法,奇偶特征是一种简单的特征值.对于一个整数,从个位开始对每一位数字编号,个位是1号,十位是2号,以此类推.这个整数在第n位上的数字记作 ...
- C++:利用如下公式,编写函数计算∏的值,直到最后一项的绝对值小于e,主程序接收从键盘输入的e,输出∏的值(保留5位小数)。 ∏/4 = 1-1/3+1/5-1/7...
利用如下公式,编写函数计算∏的值,直到最后一项的绝对值小于e,主程序接收从键盘输入的e,输出∏的值(保留5位小数). ∏/4 = 1-1/3+1/5-1/7... #include <iostr ...
- python3+selenium常用语法汇总
Selenium常用语法总结 一.Selenium常用定位语法 1.元素定位 (1)ID定位元素: find_element_by_id(‘’) (2)通过元素的类名称定位元素: find_eleme ...
- 【ABAP系列】SAP ABAP 的替代和校验
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP 的替代和校验 ...
- pandas DataFram的insert函数
原文链接:https://blog.csdn.net/yanwucao/article/details/80211984 DataFrame.insert(loc, column, value, al ...
- 【Qt开发】Qt中图像的显示与基本操作
Qt可显示基本的图像类型,利用QImage.QPxmap类可以实现图像的显示,并且利用类中的方法可以实现图像的基本操作(缩放.旋转). 1. Qt可显示的图像类型 参考Qt的帮助文档,可支持的类型,即 ...
- Canvas入门05-渐变颜色
线性渐变API: ctx.createLinearGradient(double x1, double y1, double x2, double y2) 创建一个渐变实例 (x1, y1) 渐变的起 ...
- 判断RecyclerView是否滚动到底部
转:http://www.jianshu.com/p/c138055af5d2 一.首先,我们来介绍和分析一下第一种方法,也是网上最多人用的方法: public static boolean isVi ...