1001

求个绝对值比较大小喽

1002

把字符串出现的字母记录一下,然后遍历a-z,谁第一个没出现就输出谁

1003

Problem Statement

We have N sticks with negligible thickness. The length of the i-th stick is Ai.

Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Constraints

  • 4≤N≤105
  • 1≤Ai≤109
  • Ai is an integer.

Input

Input is given from Standard Input in the following format:

N
A1 A2 ... AN

Output

Print the maximum possible area of the rectangle. If no rectangle can be formed, print 0.

题意:选出四个点能组成矩形,且面积最大

解法:选4个一样的点或者是选两个出现两次以上的最大数字

 #include<bits/stdc++.h>
using namespace std;
map<int,int>Mp,mp,ap;
int n;
long long A[];
int ans;
int main(){
long long x=,y=;
int flag1=,flag2=;
scanf("%d",&n);
for(int i=;i<=n;i++){
cin>>A[i];
Mp[A[i]]++;
}
sort(A+,A++n);
for(int i=n;i>=;i--){
if(Mp[A[i]]>=&&mp[A[i]]==){
mp[A[i]]=;
x*=A[i];
ans++;
}
if(ans==){
flag1=;
break;
}
}
for(int i=n;i>=;i--){
if(Mp[A[i]]>=){
y*=(A[i]*A[i]);
flag2=;
break;
}
}
if(flag1||flag2){
cout<<max(x,y)<<endl;
}else{
cout<<""<<endl;
}
return ;
}

Problem Statement

We have a board with a N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1×2 or 2×1 square.

Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors.

Find the number of such ways to paint the dominoes, modulo 1000000007.

The arrangement of the dominoes is given to you as two strings S1 and S2 in the following manner:

  • Each domino is represented by a different English letter (lowercase or uppercase).
  • The j-th character in Si represents the domino that occupies the square at the i-th row from the top and j-th column from the left.

Constraints

  • 1≤N≤52
  • |S1|=|S2|=N
  • S1 and S2 consist of lowercase and uppercase English letters.
  • S1 and S2 represent a valid arrangement of dominoes.

Input

Input is given from Standard Input in the following format:

N
S1
S2

Output

Print the number of such ways to paint the dominoes, modulo 1000000007.


Sample Input 1

Copy
3
aab
ccb

Sample Output 1

Copy
6

There are six ways as shown below:


Sample Input 2

Copy
1
Z
Z

Sample Output 2

Copy
3

Note that it is not always necessary to use all the colors.


Sample Input 3

Copy
52
RvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn
RLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn

Sample Output 3

Copy
958681902
解法:把上面的图染色,且相邻的颜色不同
解法:
1. 原来没有
aa
aa这种情况,就说嘛,想了好久
2.
第一次出现的是横还是竖
横 *6
竖 *3
出现横时,上一次出现的是
横 *3
竖 *2
出现竖时,上一次出现的是
横 *1
竖 *2
 #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <map>
#define int long long using namespace std; const int mod=; char str[][]; signed main()
{
int n;
scanf("%lld",&n);
for(int i=; i<; i++)
{
scanf("%s",str[i]);
}
bool flag=false;
int f=;
int t=;
for(int i=; i<n; i++)
{
if(str[][i]==str[][i+])
{
if(f==)
{
t*=;
t*=;
f=;
}
else
{
if(flag)
{
t*=;
t*=;
}
else
{
t*=;
}
}
flag=false;
i++;
}
else
{
if(str[][i]==str[][i])
{
if(f==)
{
t*=;
f=;
}
else
{
if(flag) t*=;
else t*=;
}
flag=true;
}
}
t%=mod;
}
cout<<t<<endl;
return ;
}

AtCoder Beginner Contest 071 ABCD的更多相关文章

  1. AtCoder Beginner Contest 053 ABCD题

    A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...

  2. AtCoder Beginner Contest 068 ABCD题

    A - ABCxxx Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement This contes ...

  3. AtCoder Beginner Contest 070 ABCD题

    题目链接:http://abc070.contest.atcoder.jp/assignments A - Palindromic Number Time limit : 2sec / Memory ...

  4. AtCoder Beginner Contest 069 ABCD题

    题目链接:http://abc069.contest.atcoder.jp/assignments A - K-City Time limit : 2sec / Memory limit : 256M ...

  5. AtCoder Beginner Contest 057 ABCD题

    A - Remaining Time Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Dol ...

  6. AtCoder Beginner Contest 051 ABCD题

    A - Haiku Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement As a New Yea ...

  7. AtCoder Beginner Contest 052 ABCD题

    A - Two Rectangles Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement The ...

  8. AtCoder Beginner Contest 071 D - Coloring Dominoes

    Problem Statement We have a board with a 2×N grid. Snuke covered the board with N dominoes without o ...

  9. AtCoder Beginner Contest 054 ABCD题

    A - One Card Poker Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Ali ...

随机推荐

  1. Download rtsp.c

    1. [代码][C/C++]代码 /* * Copyright (c) 2011, Jim Hollinger * All rights reserved. * * Redistribution an ...

  2. 高效上网教程---资源软件搜索技巧(搜索好用软件或者app去哪些网站)

    高效上网教程---资源软件搜索技巧(搜索好用软件或者app去哪些网站) 一.总结 一句话总结:查看下面这些网站用户推荐的 知乎:比如 小众软件 site:zhihu.com 简书:查看你需要的用户推荐 ...

  3. 如何改变cmd窗口大小

      按下Win+R(windows徽标和R一起按),再输入cmd. 输入mode ,查看当前屏幕的大小,来为后面准备(大概估计数值大小). 再输入mode con:cols=400 lines=400 ...

  4. babel-runtime 和 babel-polyfill

    Babel 默认只转换新的 JavaScript 语法 https://excaliburhan.com/post/babel-preset-and-plugins.html babel-plugin ...

  5. ubuntu c++ 关机 重启 挂起 API

    #include <unistd.h> #include <linux/reboot.h> int main() { reboot(LINUX_REBOOT_MAGIC1, L ...

  6. k8s-应用快速入门(ma)

    [root@k8s-master ~]# kubectl run nginx-deploy --image=nginx:1.14-alpine --port=80 --replicas=1 deplo ...

  7. ACM学习历程—HDU2222 Keywords Search(字典树)

    Keywords Search Description In the modern time, Search engine came into the life of everybody like G ...

  8. 有趣的Javascript:只需一个JS让万恶的IE5、IE6、IE7、IE8全都支持H5原生Canvas绘图(有演示demo)

    该demo支持IE5以上任意内核的浏览器 查看演示demo:支持IE5以上版本的浏览器Canvas绘图demo 补充:chats.js和echarts等图表库也可以使用本方法兼容IE6以上浏览器 1. ...

  9. plsql developer点滴

    PLSql中查看编译错误的具体内容: 1. 打开Command Windows show errors procedure procedure_name 

  10. 无废话WCF系列教程 -- 李林峰

    李林峰的无废话WCF入门教程 无废话WCF入门教程一[什么是WCF] 无废话WCF入门教程二[WCF应用的通信过程] 无废话WCF入门教程三[WCF的宿主] 无废话WCF入门教程四[WCF的配置文件] ...