当前位置:网站首页>2022杭电多校4
2022杭电多校4
2022-08-04 15:03:00 【ojzha_gcx】
最终结果
T1004 Link with Equilateral Triangle
说实话赛场看一眼题意然后两三分钟的时候一对队伍过了这个题就直接猜结论答案一定是No了,然后AC了。
题意:
有一个边长为n的大等边三角形。这个大三角形由n2个边长为1的小等边三角形组成。
将用以下限制来填充小三角形的每个顶点:
·填写的数字应该是0、1或2。
·大三角形的左边不应该填充0。大三角形的右边不应该填1。大三角形的底边不应该填2。
·对于每个边长为1的小三角形,三个顶点的和不应该是3的倍数。
请问当为n边形的时候是否可以填充三角形,使其满足上述所有条件?
官方的证明:对于一个合法的解,应当满足不存在同时包含0,1,2的三角形,下面我们证明这样的三角形一定存在。左下角必然是1,右下角必然是0,底边不能含有2,则底边上必然有奇数条1-0的边,这些边都属于一个小三角形。考虑其他的0-1边,由于不在两个斜边上,其他的0-1边必然属于两个三角形。因此“每个三角
形内0-1边的数量”的和必然为奇数。但是,假设不存在0-1-2的三角形,则所有三角形都必然包含0条或2条的0-1边,产生了矛盾。因此一定存在0-1-2的三角形。
#include<bits/stdc++.h>
#define LL long long
#define MIN 0xc0c0c0c0c0c0c0c0
#define PII pair<LL,LL>
#define x first
#define y second
using namespace std;
int n;
void solve()
{
cin>>n;
for(int i=1;i<=n;i++)
{
printf("No\n");
}
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif
solve();
return 0;
}
T1006 BIT Subway
题意:阅读理解一下就是计算要买同样的票,按官方给定的计费规则和按主人公yy的计费规则所需要花费的钱。
idea:赛场我的做法是按照题意分段每一种情况都进行模拟,所以写了一堆if,非常耗时间还容易绕进去。
code:
#include<bits/stdc++.h>
#define LL long long
#define MIN 0xc0c0c0c0c0c0c0c0
#define PII pair<LL,LL>
#define x first
#define y second
using namespace std;
LL n;
double ans1,ans2;
double a[101010];
void solve()
{
ans1 = ans2 = 0;
scanf("%lld",&n);
for(int i=1;i<=n;i++)
{
scanf("%lf",&a[i]);
// cout<<a[i]<<endl;
if( ans2>=200 )
{
ans2 += a[i]*0.5;
}
else if( ans2>=100 )
{
ans2 += a[i]*0.8;
}
else ans2 += a[i];
if( ans1>=200 )
{
ans1 += a[i]*0.5;
}
else if( ans1>=100 )
{
if( ans1+a[i]*0.8>200 )
{
ans1 = ans1 + (200-ans1) + ( a[i] - (200-ans1)/0.8 )*0.5;
}
else
{
ans1 = ans1 + a[i]*0.8;
}
}
else
{
if( 100/0.8 + (100-ans1) < a[i] )
{
ans1 = ans1 + ( 100-ans1 ) + 100 + ( a[i]-(100-ans1)-(100/0.8) )*0.5;
}
else if( (100-ans1)<a[i] ) //ans1+a[i]>100
{
ans1 = ans1 + (100-ans1) + ( a[i]-(100-ans1) )*0.8;
}
else
{
ans1 = ans1 + a[i];
}
}
}
printf("%.3lf %.3lf\n",ans1,ans2);
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif
int t;
cin>>t;
while( t-- )
solve();
return 0;
}
然而真实情况是对于官方的计费规则很简单,主人公YY的规则呢推一推会发现是一个关于原总票价的分段函数
T1007 Climb Stairs
边栏推荐
猜你喜欢
leetcode:259. 较小的三数之和
Leetcode: 215 disorderly to find the first big k element in the array
什么,你告诉我?作用域也分种类?
leetcode: 254. Combinations of factors
JCMsuite应用:倾斜平面波传播透过光阑的传输
Google plug-in. Download contents file is automatically deleted after solution
快速整明白Redis中的字典到底是个啥
大众点评搜索相关性技术探索与实践
基于数据库实现分布式锁
杭电校赛(逆袭指数)
随机推荐
推荐一个鸿蒙即时通讯软件《果聊》
X射线掠入射聚焦反射镜
代码随想录笔记_动态规划_1049最后一块石头的重量II
微软表示将向内部网络安全专家共享数据 为企业提供更安全保护
【剑指offer33】二叉搜索树的后序遍历序列
NPDP|作为产品经理,如何快速提升自身业务素养?
License server system does not support this version of this feature
快解析结合千方百剂
Basic Introduction for PLSQL
实际工作中的高级技术(训练加速、推理加速、深度学习自适应、对抗神经网络)
[Opportunity Enlightenment-60]: "Soldiers, Stupid Ways"-1- Opening: "Death" and "Life" are the way of heaven
RS|哨兵二号(.SAFE格式)转tif格式
华为云 & 达达,帮有情人“一键送达”
Next -18- 添加代码复制按钮
JCMsuite Application: Oblique Plane Wave Propagation Transmission Through Aperture
快速整明白Redis中的字典到底是个啥
动态数组底层是如何实现的
leetcode:254. 因子的组合
用了TCP协议,就一定不会丢包吗?
leetcode:250. 统计同值子树