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 ...
随机推荐
- python__基础 : 多继承中方法的调用顺序 __mro__方法
在多继承中,如果一个子类继承了两个平级的父类,而这两个父类有两个相同名字的方法,那么一般先继承谁,调用方法就调用先继承的那个父类的方法.如: class A: def test(self): prin ...
- Ubuntu12.04下zxing源码编译
1.下载zxing源码 git clone https://github.com/15903016222/zxing-cpp.git 2.安装依赖工具cmake sudo apt-get instal ...
- 基于CentOS-6.9_x64系统QT环境搭建
想从事QT开发的人员,首先要做的第一件事就是开发环境的搭建.本人也是一位刚入门的新手,为了搭建这么一个环境,参考了很多的网上教程,然而中间依然走了不少弯路.现将过程记录下来. 一.开发环境 Ce ...
- django使用pycharm为项目选择虚拟环境-3.1
使用pycharm打开项目 选择右上角的 file - settings - project - project interpreter 选择左上的设置符号,选择 Add 选择红框部分,然后选择之前创 ...
- reids同步机制和远程连接
RDB同步机制: 开启和关闭:默认情况下是开启了.如果想关闭,那么注释掉redis.conf文件中的所有save选项就可以了. 同步机制: save 900 1:如果在900s以内发生了1次数据更新操 ...
- STM32 USB设备描述符、配置描述符、端点描述符含义
查了一整天的资料,自己把不懂的全部试了一遍 一下是程序以及注释 /* USB设备描述符*/ const uint8_t CustomHID_DeviceDescriptor[CUSTOMHID_SIZ ...
- pix2code开发笔记
1.软件安装 首先需要安装Python3和pip (1) Python3 环境搭建 Window 平台安装 Python: https://www.python.org/downloads/wind ...
- DevExpress 操作gridcontrol
XtraGrid的关键类就是:GridControl和GridView.GridControl本身不显示数据,数据都是显示在GridView/CardView/XXXXView中.GridContro ...
- EnterpriseDB公司的 Postgres Solution Pack (一)
下载地址: http://www.enterprisedb.com/products-services-training/products/postgres-plus-solution-pack/do ...
- 北京Uber优步司机奖励政策(12月28日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...