当前位置:网站首页>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
边栏推荐
- Google plug-in. Download contents file is automatically deleted after solution
- NPDP|作为产品经理,如何快速提升自身业务素养?
- Next -20- 使用自定义样式 (custom style)
- 实际工作中的高级技术(训练加速、推理加速、深度学习自适应、对抗神经网络)
- Redis-主从复制
- IP第十五天笔记
- ASA归因:如何评估关键词的投放价值
- 广告电商系统开发功能只订单处理
- Nuget 通过 dotnet 命令行发布
- How to write SQL statements: the usage of Update, Case, and Select together
猜你喜欢
FRED Application: Capillary Electrophoresis System
直播系统开发——直播间架构的设计及难点分析
I/O stream summary
在腾讯,我的试用期总结!
leetcode: 255 Verify preorder traversal sequence binary search tree
输入输出流总结
Redis-主从复制
Zheng Qing freshmen school competition and middle-aged engineering selection competition
【历史上的今天】8 月 4 日:第一位图灵奖女性得主;NVIDIA 收购 MediaQ;首届网络安全挑战大赛完成
什么,你告诉我?作用域也分种类?
随机推荐
输入输出流总结
企业级优化
I love Tanabata hahaha
基于 Next.js实现在线Excel
16、学习MySQL 正则表达式
leetcode: 251. Expanding 2D Vectors
ping的原理
Redis-主从复制
Android Sqlite3基本命令
leetcode:251. 展开二维向量
[Problem solving] QT update component appears "To continue this operation, at least one valid and enabled repository is required"
属于程序猿的浪漫
技术分享| 小程序实现音视频通话
C# 谁改了我的代码
leetcode: 250. Count subtrees of equal value
【北亚数据恢复】IBM System Storage存储lvm信息丢失数据恢复方案
剑指Offer 63.股票的最大利润
Qt的QItemDelegate使用
Why does the decimal point appear when I press the space bar in word 2003?
Technology sharing | Description of the electronic fence function in the integrated dispatching system