当前位置:网站首页>2022 Hangzhou Electric Multi-School 4
2022 Hangzhou Electric Multi-School 4
2022-08-04 15:06:00 【ojzha_gcx】
最终结果
T1004 Link with Equilateral Triangle
To be honest, take a look at the meaning of the question on the field, and after two or three minutes, a pair of teams have passed the question and directly guessed that the answer must be yesNo了,然后AC了.
题意:
有一个边长为n的大等边三角形.This large triangle consists of n2个边长为1的小等边三角形组成.
Each vertex of the small triangle will be filled with the following constraints:
·The numbers filled in should be0、1或2.
·The left side of the large triangle should not be filled0.The right side of the large triangle should not be filled1.The base of the large triangle should not be filled2.
·For each side length is 1的小三角形,The sum of the three vertices should not be3的倍数.
please benWhether the triangle can be filled when the edge is formed,使其满足上述所有条件?
official certificate:对于一个合法的解,Should satisfy that there is no concurrent inclusion0,1,2的三角形,Next we prove that such a triangle must exist.Bottom left corner must be1,Bottom right corner must be0,Bottom edge cannot contain2,Then there must be an odd number of bars on the bottom edge1-0的边,These sides all belong to a small triangle.考虑其他的0-1边,Since it is not on the two hypotenuses,其他的0-1The sides must belong to two triangles.因此“each triangle
形内0-1边的数量”The sum must be odd.但是,假设不存在0-1-2的三角形,Then all triangles must contain0条或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
题意:Reading to understand is the calculation to buy the same ticket,According to the official charging rules and according to the protagonistyyThe billing rules need to spend money.
idea:My approach in the field is to simulate each situation according to the meaning of the question,So I wrote a bunchif,Very time consuming and easy to get around.
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;
}
The truth, however, is that the official billing rules are simple,主人公YYThe rule of it will be found to be a piecewise function of the original total fare
T1007 Climb Stairs
边栏推荐
猜你喜欢
随机推荐
leetcode:212. 单词搜索 II
leetcode: 251. Expanding 2D Vectors
Android Sqlite3 basic commands
《分布式云最佳实践》分论坛,8月11日深圳见
Redis 高可用
leetcode:255 验证前序遍历序列二叉搜索树
MVCC实现过程
Redis-哨兵模式
特殊品种的二次开户验资金额
大众点评搜索相关性技术探索与实践
Database recovery
leetcode: 259. Smaller sum of three numbers
Sublime Text 好用的插件
从-99打造Sentinel高可用集群限流中间件
PTA 6-2 多项式求值
Oracle database user creation, restart, import and export
Redis-哨兵模式
程序猿七夕礼物-如何30分钟给女朋友快速搭建专属语聊房
leetcode:215无序数组中找第k大的元素
卖家寄卖流程梳理