JankTao相亲记

解法:排序

#include

#include

#include

#include

#include

#include

#include

#include

using namespace std;

const double INF = 1e20;

const double pi = acos(-1.);

int main()

{

int t;

int a[100];

while(cin>>t)

{

while(t--)

{

for(int i=0;i<11;i++)

{

cin>>a[i];

}

sort(a,a+11);

printf("%d\n",a[9]);

}

}

return 0;

}

David的沙漠之路

解法:贪心,尽量往最大的距离走,加上它经历过的加油站中最大的那个,模拟这个过程需要考虑很多情况

#include

#include

#include

using namespace std;

struct cmp

{

bool operator ()(int &a,int &b)

{

return a

}

};

struct node

{

int x,y;

} e[1005];

int main()

{

priority_queue,cmp>que;

int T;

scanf("%d",&T);

while(T--)

{

int n,l,s,x,y,cnt=0,flag=0,f=0;

scanf("%d%d%d",&n,&l,&s);

for(int i=0; i

{

scanf("%d%d",&e[i].x,&e[i].y);

}

e[n].x=0,e[n].y=l;

for(int i=0; i<=n; i++,f=0)

{

x=e[i].x,y=e[i].y;

if(y<=s)

{

que.push(x);

f=1;

//最长可以横跨多少加油站,把他们放在队列里

}

while(y>=s)

{

if(s>=l) break;

if(!f && s==y)

{

que.push(x);

f=1;

//没有横跨,刚刚好到达

}

if(que.empty())

{

printf("TJ\n");

flag=1;

break;

}

int xx=que.top();//取最近的加油站

que.pop();

s+=xx;

cnt++;

}

if(!f) que.push(x);

if(s>=l)

{

printf("%d\n",cnt);

flag=1;

break;

}

if(flag) break;

}

if(!flag) printf("TJ\n");

while(!que.empty()) que.pop();

}

return 0;

}

TJ的文件系统

解法:字符串处理

#include

//#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#define inf 0x3fffffff

#define lson l,m,rt<<1

#define rson m+1,r,rt<<1|1

#define LL long long

using namespace std;

const int maxn = 22;

int main()

{

int t;

int n;

int i;

int j;

string s,ss;

while(cin>>t)

{

while(t--)

{

string sss="";

int ans;

cin>>n>>s;

for(i=0;i

{

string sss="";

cin>>ss;

ans=ss.find(".");

// cout<

for(j=ans+1;j

{

sss+=ss[j];

}

// cout<

if(sss==s)

{

cout<

}

}

}

}

return 0;

}

握手定理

解法:水题

#include

int main()

{

int SEQ, ACK1, ACK2, T;

scanf("%d", &T);

while(T--)

{

scanf("%d %d %d", &SEQ, &ACK1, &ACK2);

if((ACK1 == SEQ + 1) && (ACK2 == ACK1 + 1))

{

printf("QWN3213\n");

}

else

printf("TJ\n");

}

return 0;

}

Alice AND Bob

解法:模拟

#include

//#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#define inf 0x3fffffff

#define lson l,m,rt<<1

#define rson m+1,r,rt<<1|1

#define LL long long

using namespace std;

int a[100000],b[100000],c[100000];

int main()

{

int t;

int i,j;

int n,m;

int x,y;

int k;

cin>>t;

while(t--)

{

k=0;

cin>>n>>m;

memset(a,0,sizeof(a));

memset(b,0,sizeof(b));

for(i=0;i

{

cin>>x;

a[x]++;

}

for(i=0;i

{

cin>>y;

b[y]++;

}

for(i=0;i<100000;i++)

{

if(a[i]&&b[i])

c[k++]=i;

}

for(i=0;i

{

if(i==0)

{

printf("%d",c[i]);

}

else

{

printf(" %d",c[i]);

}

}

cout<

}

return 0;

}

建群数据

解法:字符串处理时间

#include

//#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#define inf 0x3fffffff

#define lson l,m,rt<<1

#define rson m+1,r,rt<<1|1

#define LL long long

using namespace std;

struct P

{

int number;

int hhmmss;

}hehe[100000];

int cmp(P a,P b)

{

if(a.number==b.number)

return a.hhmmss

else

return a.number

}

string s,ss,sss,ssss;

string sssss;

int t,n;

int a;

int i,j;

int ans;

int poi;

int num;

int main()

{

cin>>t;

while(t--)

{

poi=1;

cin>>n;

for(i=0;i

{

cin>>a>>s;

hehe[i].number=a;

ss=s.substr(0,2);

sss=s.substr(2,2);

ssss=s.substr(4,2);

// cout<

hehe[i].hhmmss=((ss[0]-‘0‘)*10+(ss[1]-‘0‘)*1)*3600+((sss[0]-‘0‘)*10+(sss[1]-‘0‘))*60+((ssss[0]-‘0‘)*10+(ssss[1]-‘0‘));

}

cin>>sssss;

ss=sssss.substr(0,2);

sss=sssss.substr(2,2);

ssss=sssss.substr(4,2);

ans=((ss[0]-‘0‘)*10+(ss[1]-‘0‘))*3600+((sss[0]-‘0‘)*10+(sss[1]-‘0‘))*60+((ssss[0]-‘0‘)*10+(ssss[1]-‘0‘));

sort(hehe,hehe+n,cmp);

num=hehe[0].hhmmss;

for(int i=1;i

{

if(hehe[i].number!= hehe[i-1].number||hehe[i].hhmmss-num>ans)

{

poi++;

num=hehe[i].hhmmss;

}

}

printf("%d\n",poi);

}

return 0;

}

江西理工大学c语言考试题库,江西理工大学C语言程序设计竞赛(初级组)(示例代码)...相关推荐

  1. c语言源代码下载TGAM,2018年江西理工大学C语言程序设计竞赛(初级组)一

    C语言中保留3位小数用%.3lf   用法:printf("%.3lf",result) 四边形分凸凹四边形. aaarticlea/png;base64,iVBORw0KGgoA ...

  2. 下面合法的C语言字符常量是( ),C语言考试题库及答案

    <C语言考试题库及答案>由会员分享,可在线阅读,更多相关<C语言考试题库及答案(52页珍藏版)>请在人人文库网上搜索. 1.C语言考试题库及答案C语言理论上机考试选择题部分(共 ...

  3. c语言二级考试真题新疆,新疆自治区计算机二级C语言考试题库.doc

    新疆自治区计算机二级C语言考试题库.doc 一单选题1.已知 int a,b;下列 switch语句中正确的是 b . A. switchacase a a;break;case b b;break; ...

  4. c语言第一章考试题及答案,C语言考试题库及答案整理版.doc

    C语言考试题库及答案整理版.doc C语言理论上机考试选择题部分(共200题) 1.下面程序的输出是___D______ #include void main() { int k=11; printf ...

  5. kij是不是c语言语句,C语言考试题库及答案分析(总35页).doc

    C语言考试题库及答案分析(总35页).doc C语言理论上机考试选择题部分(共200题,仅针对11级定向专业)1.下面程序的输出是_Dincludestdio.hvoid main int k11; ...

  6. 陕科大c语言题库,C语言考试题库

    <C语言考试题库>由会员分享,可在线阅读,更多相关<C语言考试题库(30页珍藏版)>请在人人文库网上搜索. 1.1. 编程题请编写函数fun,其功能是:将两个两位数的正整数a. ...

  7. c语言判断非法字符题目,C语言考试题库之判断题-c语言考试判断题

    <C语言考试题库之判断题-c语言考试判断题>由会员分享,可在线阅读,更多相关<C语言考试题库之判断题-c语言考试判断题(7页珍藏版)>请在人人文库网上搜索. 1.三.判断题(1 ...

  8. 北师大c语言2019在线作业,2019最新C语言考试题库及答案

    <2019最新C语言考试题库及答案>由会员分享,可在线阅读,更多相关<2019最新C语言考试题库及答案(100页珍藏版)>请在人人文库网上搜索. 1.2019最新C语言考试题库 ...

  9. c语言笔试题目,C语言考试题库及答案2015.doc

    C语言考试题库及答案2015.doc - PAGE 1 - C语言(共200题) 1.下面程序的输出是___D______ #include void main() { int k=11; print ...

最新文章

  1. Django中的Form
  2. linux支持sshd救援模式,单用户、救援模式、克隆、两机互联
  3. 数据採集器服务——Socket(今天才发现AES加解密代码跟贴的时候不一样,貌似乱码,不知什么情况)...
  4. windows mysql is read only_mysql中Table is read only错误解决方法(转载)
  5. LeetCode 1347. 制造字母异位词的最小步骤数
  6. 终极分类器(识别器),一个人工智能的美好愿景
  7. txt转excel 处理数据
  8. Win11更改微软应用商店下载路径
  9. 百度网盘高速下载资源
  10. 2016服务器系统驱动,windows sever2016驱动大家是怎么装的啊
  11. 智能配电房综合环境监控系统
  12. win10永久自动更新服务器,win10彻底永久关闭自动更新的方法【已验证有效】
  13. flex android开发中关于请求报文技术操作问题
  14. Unity给手加入圆柱骨骼
  15. 手机里android文件里哪些文件可删除,手机文件夹哪些可以删除?这4个删除它妥妥的...
  16. EIP-3523:半同质代币介绍
  17. 计算机音乐代表人物,在你的周围,一定有许多名人吧!比如:故事大王xxx,电脑高手xxx,音乐家xxx……请你选择其中一...
  18. 记 安装单机版 腾讯 蓝鲸智云
  19. ELK---索引(Elasticsearch 7.17)
  20. 持续学习常用6种方法总结:使ML模型适应新数据的同时保持旧数据的性能

热门文章

  1. VisualStudio2005英文版被SQL2005简体中文版汉化
  2. Windows下MySQL的详细安装教程
  3. 数据库系统原理选择题
  4. (亲测无坑)Centos7.x使用kubeadm安装K8s集群1.15.0版本
  5. BGP的community属性
  6. nginx代理tomcat,https
  7. MySQL中的备份和恢复
  8. CentOS下gitlab迁移和升级
  9. JAVA中遗留的问题_java中遗留的小问题
  10. 攻防比赛_深度:一场攻防杂乱的比赛,凸显了索肖三中卫阵型的核心是谁