博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Tinkoff Challenge - Final Round (ABC)
阅读量:6976 次
发布时间:2019-06-27

本文共 1285 字,大约阅读时间需要 4 分钟。

A题:从两个保安中间那钞票

1 #include 
2 3 using namespace std; 4 5 int main() 6 { 7 int a,b,c; 8 scanf("%d%d%d",&a,&b,&c); 9 int n;10 scanf("%d",&n);11 int pos;12 int ans = 0;13 for(int i=0;i
b&&pos
View Code

 

B题:切胡萝卜,每个面积相等;公式化简到最简试,否则精度会损失

1 #include 
2 3 using namespace std; 4 5 int main() 6 { 7 int n; 8 double h; 9 scanf("%d%lf",&n,&h);10 /*11 double s = h/n;12 double S = h;13 for(int i=0;i
View Code

 

C题:两个绝顶聪明的人,第一个人要字典序最小,第二个人字典序最大;

贪心:

第一个人从小到大排,第二个人从大到小排,

当第一个人的最小的都大于第二个人的,那么他只能放到字符后面(否则第二个人就得逞了,他把他的放到后面),但是这样还不够,因为他反正还要继续放,那么他后面的操作将大于这次的,为何不交换一下呢? 这时,他应该从他的最大的那一个放到后面;

1 #include 
2 3 #include
4 5 #include
6 7 #include
8 9 using namespace std;10 11 const int maxn=300000+10;12 13 char A[maxn],B[maxn],ans[maxn];14 15 bool cmp(char a,char b) {16 return a>b;17 }18 19 int main() {20 21 scanf("%s%s",A,B);22 int len=strlen(A);23 int l1=0,l2=0;24 int r1,r2;25 int L=0,R=len-1;26 r1=(len+1)/2-1;27 r2=len/2-1;28 sort(A,A+len);29 sort(B,B+len,cmp);30 for(int i=0; i
View Code

 

转载于:https://www.cnblogs.com/TreeDream/p/6863485.html

你可能感兴趣的文章
说说 PWA 和微信小程序--Progressive Web App
查看>>
kill命令"-1"这个参数到底是杀进程还是reload?(转)
查看>>
struts2 result type=(chain、dispatcher、redirect、redirect-action)
查看>>
mysql foreign key(外键)
查看>>
Good Bye 2016 - C
查看>>
关于技术型人才与研究型人才
查看>>
GDB调试程序(完全手册)
查看>>
httpd: apr_sockaddr_info_get() failed for centossvn
查看>>
《Head First 统计学》读书笔记
查看>>
vim配置C++博文整理
查看>>
深入解析Windows操作系统笔记——CH1概念和术语
查看>>
来玩Play框架07 静态文件
查看>>
include和require的区别
查看>>
NuGet 无法连接到远程服务器-解决方法
查看>>
按键驱动的恩恩怨怨之概述
查看>>
第22周二
查看>>
数位dp(求1-n中数字1出现的个数)
查看>>
html传參中?和&
查看>>
AMD and CMD are dead之js模块化黑魔法
查看>>
Tesseract 3 语言数据的训练方法
查看>>