ACM 第一天
标签库元素:
队列<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
The first line contains an integer n (1≤n≤106).
1
2
3
#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
Chiaki would like to construct n disjoint triangles where each vertex comes from the 3n points.
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.
1
1 2
2 3
3 5
#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
Given a time in Beijing time (UTC +8), Chiaki would like to know the time in another time zone s.
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).
11 11 UTC+8
11 12 UTC+9
11 23 UTC+0
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 第一天的更多相关文章
- ACM第一站————快速排序
转载请注明出处,谢谢!http://www.cnblogs.com/Asimple/p/5455125.html 快速排序(Quicksort)是对冒泡排序的一种改进. 快速排序由C. A. ...
- ACM第一阶段学习内容
一.知识目录 字符串处理 ................................................................. 3 1.KMP 算法 .......... ...
- 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. ...
- ACM Sdut 2158 Hello World!(数学题,排序) (山东省ACM第一届省赛C题)
题目描述 We know thatIvan gives Saya three problems to solve (Problem F), and this is the firstproblem. ...
- ACM第一天研究懂的AC代码——BFS问题解答——习题zoj2165
代码参考网址:http://blog.csdn.net/slience_perseverance/article/details/6706354 试题分析: 本题是研究red and black的一个 ...
- 一份传世典文:十年编程(Teach Yourself Programming in Ten Years)
原文:Teach Yourself Programming in Ten Years作者:郭晓刚翻译:郭晓刚(foosleeper@163.net)最后修订日期:2004-3-192005-01-12 ...
- “21天教你学会C++”
下面是一个<Teach Yourself C++ in 21 Days>的流程图,请各位程序员同仁认真领会.如果有必要,你可以查看这个图书以作参照:http://www.china-pu ...
- LDA相关论文汇总
转:http://blog.csdn.net/pirage/article/details/9467547 LDA理论 David M. Blei, Andrew Y. Ng, and Michael ...
- 第一届山东省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 ...
随机推荐
- React基本语法
React 一.导入 0.局部安装 react 和 react-dom npm install --save-dev react react-dom 1.react ...
- 2. HTML常用标签
相信大家常常会打开浏览器搜索一些内容或者浏览一些网站,在浏览器的页面上会呈现很多内容,但是具体的形式无非就是图片.文字以及链接(可以点击进入另一个页面的特殊文字),其中文字承载着巨大的作用,传递着各种 ...
- linux 操作之压缩与解压
压缩与解压 压缩格式:zip , rar , 7z , iso , exe gzip (以下是命令操作) gzip [文件名] #压缩成gz格式 , 原来的文件消失 , 不支持目录. bzip2 - ...
- gmtime与mktime的重新编写
这几日发现Linux的mktime与gmtime所处理的数据类型是32位的,即代表时间设置只能设置到2038年,在公司的产品要实现这个时间的突破还是得自己写一个新的处理时间的函数. 作为一个刚毕业的程 ...
- macos 安装 brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ...
- windows下安装mongodb的崩溃史
一.下载 官方网站的下载页面打不开https://www.mongodb.com/download-center?jmp=nav 问朋友要了一份,是3.6的,下载安装会卡死.弄了一个小时也半点反应没有 ...
- springboot与activemq的使用
1.springboot和activemq的使用相对来说比较方便了,我在网上看了很多其他的资料,但是自己写出来总是有点问题所以,这里重点描述一下遇到的一些问题. 2.至于activemq的搭建和spr ...
- CSS3 子节点选择器
CSS3中新增了几个子元素选择器,大大提高了开发者的开发效率.之前有些要通过为一个个子元素添加class,或者js实现才能实现的效果.现在可以很方便的用选择器实现. 这些新的样式已被现代浏览器及IE9 ...
- outer join test
create table t1_outerjoin(a int, b int , c int); create table t2_outerjoin(a int); create table t3_o ...
- ubuntu 14.04 lts LAMP配置
一.目标 创建服务器环境,主要包括:Apache2.4.7 serverPHP 5.5.9Mysql 5.5.49扩展:MemcacheMcrypt 二.准备工作 1.服务器系统版本 Ubuntu s ...