Codeforces Round #384 (Div. 2) 水题解题报告
来源:互联网 发布:初中化学仿真实验软件 编辑:程序博客网 时间:2024/05/22 12:57
这场单div2略水,E题本来想暴力怼怼怕过不了就没写,结果发现n才1000,后悔啊
D题没看得懂q巨的一句话题解的意思
下面是前三题的代码
743A-Vladik and flights
Vladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is not as easy as it sounds: the question Vladik face now is to find the cheapest way to get to the olympiad….
题意就是你从a到b,如果数字相同花费为0,不同花费为编号差,求最小花费。
刚开始模拟杠这道题被hack推了一下发现必然只有0和1两种情况,判断一下就好了
#include<bits/stdc++.h>using namespace std;int main(){ int n,a,b; string s; cin>>n>>a>>b; cin>>s; if(s[a]==s[b]) cout<<"0"<<endl; else cout<<"1"<<endl; return 0;}
743B-Chloe and the sequence
Chloe, the same as Vladik, is a competitive programmer. She didn’t have any problems to get to the olympiad like Vladik, but she was confused by the task proposed on the olympiad…
构造一个1213121412131215121312141213121…
输入n,k,求k位置的数。
推了一下发现和n无关一个长度很长的序列构造肯定不行,每次对除以二直到第一次不能整除。
#include<bits/stdc++.h>typedef long long ll;using namespace std;int main(){ ll b,a,ans=1; cin>>b>>a; while(a%2==0) { a/=2; ans++; } cout<<ans<<endl; return 0;}
743C-Vladik and fractions
Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n he can represent fraction 2/n as a sum of three distinct positive fractions in form 1/m…
题意就是给你一个2/n,让你构造出三个埃及分数。
听csy在群里说一下2/n=1/n+1/(n+1)+1/(n^2+n)
一下子全世界都会写这题了,注意n=1的时候要输出-1
#include<bits/stdc++.h>using namespace std;typedef long long ll;int main(){ ///2/n=1/n+1/(n+1)+1/(n^2+n) ll a; cin>>a; if(a==1) cout<<"-1"<<endl; else if(a==2) cout<<"2 3 6"<<endl; else if(a==3) cout<<"2 7 42"<<endl; else cout<<a<<" "<<a+1<<" "<<a*(a+1)<<endl; return 0;}
- Codeforces Round #384 (Div. 2) 水题解题报告
- Codeforces Round #192 (Div. 2) 题解报告
- Codeforces Round #363 (Div. 2) 题解报告
- Codeforces Round #365 (Div. 2)题解报告
- Codeforces Round #366 (Div. 2)题解报告
- Codeforces Round #375 (Div. 2)题解报告
- Codeforces Round #377 (Div. 2)题解报告
- Codeforces Round #378 (Div. 2)题解报告
- Codeforces Beta Round #34 (Div. 2) A题解题报告
- Codeforces Round #179 (Div. 2) A题解题报告
- Codeforces Round #188 (Div. 2) A题解题报告
- Codeforces Round #185 (Div. 2) A题解题报告
- Codeforces Round #238 (Div. 2)前3题解题报告
- Codeforces Round #240 (Div. 2)(前三题解题报告)
- 【codeforces】Codeforces Round #276 (Div. 2) 题解
- 【codeforces】Codeforces Round #277 (Div. 2) 题解
- 【codeforces】Codeforces Round #279 (Div. 2) 题解
- 【codeforces】Codeforces Round #283 (Div. 2) 【题解】
- AIX 日常管理常用命令
- Unity开发Android游戏(二)Hello world!
- web前后台数据交互的几种方式
- 3D打印技术之切片引擎(2)
- java web.xml文件中的url-pattern 中的/ 与/*的区别
- Codeforces Round #384 (Div. 2) 水题解题报告
- hadoop学习第十二节:Flume介绍与安装
- Windows下用VMware安装Linux系统
- java线程中时间戳报错及时间戳获取问题
- 介绍几个ipad的使用技巧
- $location服务
- ajax回填表单获取json中的某个值
- QTextEdit高度自适应的问题
- 工作总结