HLG2157【找规律】

吃豆豆
Time Limit: 1000 MSMemory Limit: 32768 K
Total Submit: 59(40 users)Total Accepted: 34(34 users)Rating: Special Judge: No
Description

一天Woods和他的GrilFriend(GF)来到了一个童话王国的小镇里,镇上有许多豆豆(如下图中的每个圆形为一个豆豆),每个豆豆有通向东,南,西,北,东南,东北,西北,西南八个方向的道路。其中直线道路的距离为1米,斜线道路的距离为根号2米。GF一看见吃的就饿了……你能算出吃且只吃所有豆豆一次,最后回到起点的最短路程吗?

 

如图所示为一个2 x 3的图,最短距离(如红线所示)为6米。

Input

多组测试数据。每组测试数据一行,包括两个整数N,M(1 < m < 50 and 1 < n < 50.),代表图的大小为N行M列。

Output

对于每组数据输出一行,输出吃且只吃所有豆豆一次,最后回到起点的最短路程。(精确到两位小数)。

Sample Input
2 2
2 3
Sample Output

4.00

6.00

Hint

 

Source
2014暑假集训练习赛(8月13日)

分析:找规律

代码:

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cmath>
 4 using namespace std;
 5 
 6 int main() {
 7     int a, b;
 8     while(EOF != scanf("%d %d",&a, &b) ) {
 9         double ans = a * b + 1e-9;
10         if(a % 2 == 1 && b % 2 == 1) ans += sqrt(2) - 1.0;
11         printf("%.2lf\n",ans);
12     }
13     return 0;
14 }
View Code

 

a对应E,b对应Q,c对应T,d对应N,e对应G,f对应Z,g对应C,h对应L,i对应B,j对应A,k对应M,l对应R,m对应P,n对应U,o对应V,p对应S,q对应X,r对应K,s对应F,t对应H,u对应D,v对应I,w对应W,x对应O,y对应Y,z对应J。不分大小写,且对应不可逆,省略数字符号。将下面一段明文根据对应,写出对应的密文The technology for securely sharing data has grown extensively in recent years. Many users are willing to share their lightweight mobile device data via social networks or the cloud. A novel matchmaking encryption primitive was proposed in CRYPTO’19, whose potential for privacy protection and data sharing security was introduced. However, matchmaking encryption technology faces challenges in flexibly realizing critical functions, such as one-to-many non-interactive scenarios, no key escrow problem, stronger security, lightweight computation and low communication overheads for mobile devices, which impede their widespread application. To achieve the above functions, we present a lightweight certificateless multi-user matchmaking encryption (LC-MUME) for mobile devices, which enhances security flexibly and performance based on standard hard assumptions and low-consumption pairing-free technology, while also avoiding one-by-one encryption for each user. The proposed LC-MUME scheme enjoys minor computation and communication overheads in a one-to-many non-interactive certificateless cryptosystem. We prove that our scheme achieves indistinguishability-based chosen-ciphertext attack (IND-CCA) security, the existential unforgeability under a chosen message attack (EU-CMA) security and anonymity-CCA security under the random oracle model. Our LC-MUME scheme outperforms the state-of-the-art schemes regarding efficiency and flexibility, as demonstrated by the performance comparison and analysis, and therefore is a practical solution for resource-constrained mobile devices.
03-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值