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 ...
随机推荐
- ajaxSubmit 在ie9或360兼容中,form下是空的
解决办法:在<head>....</head>中加入<meta http-equiv="X-UA-Compatible" content=" ...
- 分页插件pagehelper ,在sql server 中是怎么配置的
<configuration> <plugins> <!-- com.github.pagehelper为PageHelper类所在包名 --> <plugi ...
- web开发问题汇总
Meta基础知识: H5页面窗口自动调整到设备宽度,并禁止用户缩放页面 //一.HTML页面结构 <meta name="viewport" content="wi ...
- Java : logback简单配置
需要把logback.xml文件放在类路径下,如果是spring boot项目可以用 logging.config=classpath:log/xxxxxx.xml来指定配置文件 logback la ...
- python3的下载与安装
python3的下载与安装 1.首先,从Python官方网站:http://python.org/getit/ ,下载Windows的安装包 ython官网有几个下载文件,有什么区别?Python 3 ...
- ubuntu解决网易云无法打开
最近首次入手ubuntu18 摸索了很久,当然网易云是不可缺少的一部分,在配置好各种环境+程序后,也找到了解决网易云的方法了. 首先安装好网易云 默认情况下需要在终端使用 sudo 才能运行 解决的办 ...
- sql server 获取当前日期前三十天的日期
select convert(varchar(10),dateadd(dd,number,dateadd(month,-1,getdate())),120) as dtfrom master..spt ...
- 爬取 StackOverFlow 上有关于 Python 的问题
给定起始页面以及爬取页数,要求得到每一个问题的标题.票数.回答数.查看数 stackflow <- function(page){ url <- "http://stackove ...
- E. Almost Regular Bracket Sequence
题目链接:http://codeforces.com/contest/1095/problem/E 解题心得: 刚开始拿到这个题的时候还真的没什么思路,后来仔细想想还是比较简单的.首先题目要求翻转一个 ...
- Visual studio 2010 TFS地址解析,让团队资源管理器不再显示IP地址
第一步: 找到名为hosts的配置文件(路径C:\Windows\System32\drivers\etc\hosts)用记事本打开并写入需要的配置,例如我用到的是TFS服务器的IP地址为192.16 ...