标签库元素:

队列<queue> FIFO

栈 <stack>  FICO

集合 set

不定长数组  vector

映射 map

Maximum Multiple

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3985    Accepted Submission(s): 926

Problem Description
Given an integer n, Chiaki would like to find three positive integers x, y and z such that: n=x+y+z, x∣n, y∣n, z∣n and xyz is maximum.
 
Input
There are multiple test cases. The first line of input contains an integer T (1≤T≤106), indicating the number of test cases. For each test case:
The first line contains an integer n (1≤n≤106).
 
Output
For each test case, output an integer denoting the maximum xyz. If there no such integers, output −1 instead.
 
Sample Input
3
1
2
3
 
Sample Output
-1 -1 1
 #include<iostream>
#include<vector>
#include<stdio.h>
using namespace std; int main()
{
long long n;
int t ;
cin>>t;
while(t--)
{
scanf("%lld",&n);
if(n% == ) cout<<(n/)*(n/)*(n/)<<endl;
else
{
if(n% == ) cout<<(n/)*(n/)*(n/)<<endl;
else cout<<-<<endl;
} }
return ;
}

Triangle Partition

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 132768/132768 K (Java/Others)
Total Submission(s): 2140    Accepted Submission(s): 925
Special Judge

Problem Description
Chiaki has 3n points p1,p2,…,p3n. It is guaranteed that no three points are collinear.
Chiaki would like to construct n disjoint triangles where each vertex comes from the 3n points.
 
Input
There are multiple test cases. The first line of input contains an integer T, indicating the number of test cases. For each test case:
The first line contains an integer n (1≤n≤1000) -- the number of triangle to construct.
Each of the next 3n lines contains two integers xi and yi (−109≤xi,yi≤109).
It is guaranteed that the sum of all n does not exceed 10000.
 
Output
For each test case, output n lines contain three integers ai,bi,ci (1≤ai,bi,ci≤3n) each denoting the indices of points the i-th triangle use. If there are multiple solutions, you can output any of them.
 
Sample Input
1
1
1 2
2 3
3 5
 
Sample Output
1 2 3
 #include<iostream>
#include<vector>
#include<cstdio>
#include<algorithm>
using namespace std;
struct P
{
long long x,y;
int id;
}p[+];
int cmp(P a,P b)
{
return a.x<b.x;
} int main()
{ int t;
cin>>t;
while(t--)
{
int n ;
cin>>n;
for(int i = ;i <= *n;i++)
{
scanf("%lld %lld",&p[i].x,&p[i].y);
p[i].id = i;
}
sort(p+,p+*n+,cmp); for(int i = ;i<=*n;i++)
{ cout<<p[i].id;
if(i% == ) cout<<endl;
else cout<<" ";
}
}
return ;
}

Time Zone

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 5204    Accepted Submission(s): 878

Problem Description
Chiaki often participates in international competitive programming contests. The time zone becomes a big problem.
Given a time in Beijing time (UTC +8), Chiaki would like to know the time in another time zone s.
 
Input
There are multiple test cases. The first line of input contains an integer T (1≤T≤106), indicating the number of test cases. For each test case:
The first line contains two integers a, b (0≤a≤23,0≤b≤59) and a string s in the format of "UTC+X'', "UTC-X'', "UTC+X.Y'', or "UTC-X.Y'' (0≤X,X.Y≤14,0≤Y≤9).
 
Output
For each test, output the time in the format of hh:mm (24-hour clock).
 
Sample Input
3
11 11 UTC+8
11 12 UTC+9
11 23 UTC+0
 
Sample Output
11:11
12:12
03:23
 #include <bits/stdc++.h>
#include <vector>
#include <queue> using namespace std; int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int a,b;
char f;
double k;
int q=;
scanf("%d %d UTC%c%lf",&a,&b,&f,&k);
k=k*;
int m1=((int)k%)*;
int h1=(int)k/;
a=(a-+)%; if(f=='+')
{
if(b+m1>=)
{
q=;
}
else q=;
m1=(b+m1)%;
h1=(a+q+h1)%;
}
else if(f=='-')
{
if(m1>b)
{
q=;
}
else q=; m1=(b+-m1)%; h1=(a-q-h1+)%; }
if(h1<=)
{
printf("0%d:",h1);
}
else printf("%d:",h1); if(m1<=)
{
printf("0%d\n",m1);
}
else printf("%d\n",m1); } return ;
}

ACM 第一天的更多相关文章

  1. ACM第一站————快速排序

    转载请注明出处,谢谢!http://www.cnblogs.com/Asimple/p/5455125.html   快速排序(Quicksort)是对冒泡排序的一种改进.   快速排序由C. A. ...

  2. ACM第一阶段学习内容

    一.知识目录 字符串处理 ................................................................. 3 1.KMP 算法 .......... ...

  3. Sdut 2151 Phone Numbers (山东省ACM第一届省赛题 A)

    题目描述 We know thatif a phone number A is another phone number B's prefix, B is not able to becalled. ...

  4. ACM Sdut 2158 Hello World!(数学题,排序) (山东省ACM第一届省赛C题)

    题目描述 We know thatIvan gives Saya three problems to solve (Problem F), and this is the firstproblem. ...

  5. ACM第一天研究懂的AC代码——BFS问题解答——习题zoj2165

    代码参考网址:http://blog.csdn.net/slience_perseverance/article/details/6706354 试题分析: 本题是研究red and black的一个 ...

  6. 一份传世典文:十年编程(Teach Yourself Programming in Ten Years)

    原文:Teach Yourself Programming in Ten Years作者:郭晓刚翻译:郭晓刚(foosleeper@163.net)最后修订日期:2004-3-192005-01-12 ...

  7. “21天教你学会C++”

    下面是一个<Teach Yourself  C++ in 21 Days>的流程图,请各位程序员同仁认真领会.如果有必要,你可以查看这个图书以作参照:http://www.china-pu ...

  8. LDA相关论文汇总

    转:http://blog.csdn.net/pirage/article/details/9467547 LDA理论 David M. Blei, Andrew Y. Ng, and Michael ...

  9. 第一届山东省ACM——Phone Number(java)

    Description We know that if a phone number A is another phone number B’s prefix, B is not able to be ...

随机推荐

  1. Java开发小技巧(五):HttpClient工具类

    前言 大多数Java应用程序都会通过HTTP协议来调用接口访问各种网络资源,JDK也提供了相应的HTTP工具包,但是使用起来不够方便灵活,所以我们可以利用Apache的HttpClient来封装一个具 ...

  2. 利用HaoheDI从数据库抽取数据导入到hbase中

    下载apache-phoenix-4.14.0-HBase-1.4-bin.tar.gz 将其中的 phoenix-4.14.0-HBase-1.4-client.jar phoenix-core-4 ...

  3. Linux命令集锦

    梳理常用的Linux命令 day1--cd命令 cd命令:(注意以下的命令,cd后均有一个空格) 1.进入盘符: cd f: 2.进入当前目录命令: cd . 3.进入指定文件夹(在进入确定盘符之后, ...

  4. docker swarm的应用----docker集群的构建

    一.docker安装 这里我们安装docker-ce 的18.03版本 yum    -y remove docker  删除原有版本 #安装依赖包 [root@Docker ~]# yum -y i ...

  5. c语言中:strlen和sizeof的区别和它们分别交换各自作用领域(\0问题)时的细微差别!!!

    本人c语言初学菜鸟一枚,今天通过敲了一段简单代码,发现strlen和sizeof之间的一些关系,总结如下: 用strlen计算数组长度要考虑进去\0 用sizeof计算字符串长度也要考虑进去\0 而s ...

  6. react前置路由守卫

    react中一切皆组件-- 目标:自定义user界面的前置路由守卫,当用户点击要进入user组件时,路由守卫发起判断,如果条件满足则进入,否则跳转至login组件. .入口文件index.js中代码如 ...

  7. 数据库 MySQL part4

    存储引擎 什么是存储引擎? mysql中建的库是文件夹,建的表是文件.文件有不同的类型,数据库中的表也有不同的类型,表的类型不同,会对应mysql不同的存取机制,表类型又称为存储引擎. 存储引擎说白了 ...

  8. BZOJ1432_Function_KEY

    题目传送门 找规律. 画一个像这样的图: 不同颜色为不同层,因为函数图像可对称,所以只考虑K<=N/2的情况. 最小为min(K,N-K+1)*2. N=1时特殊考虑,答案为1. code: # ...

  9. zabbix经常报警elasticsearch节点TCP连接数过高问题

    单服务器最大tcp连接数及调优汇总 单机最大tcp连接数 网络编程 在tcp应用中,server事先在某个固定端口监听,client主动发起连接,经过三路握手后建立tcp连接.那么对单机,其最大并发t ...

  10. IAR环境下编译CC2640入门开发

    1. 安装SDK包,之后导入AIR里面,编译报错 看样子似乎是xdc工具的路径配置不对,进入路径配置对话窗 开始配置 配置完之后,重新编译 Fatal Error[Pe1696]: cannot op ...