# AtCoder Grand Contest 028 A：Two Abbreviations

## 题目翻译

\(1\)、对于第\(1\)位、第\(l/n+1\)位，第\(2*l/n+1\)位……第\((n-1)*l/n+1\)位的字符串依次拼接等于\(s\)。

\(2\)、对于第\(1\)位、第\(l/m+1\)位，第\(2*l/m+1\)位……第\((m-1)*l/m+1\)位的字符串依次拼接等于\(t\)。

## 题解

``````#include <map>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;

const int maxn=1e5+5;

ll l;int n,m;
map<int,int>good;
char s[maxn],t[maxn];

int x=0,f=1;char ch=getchar();
for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
return x*f;
}

int gcd(int a,int b) {
if(!b)return a;
return gcd(b,a%b);
}

int main() {
scanf("%s%s",s,t);
l=1ll*n*m/gcd(n,m);
for(int i=0;i<n;i++)
good[i*(l/n)+1]=s[i];
for(int i=0;i<m;i++)
if(good[i*(l/m)+1]&&good[i*(l/m)+1]!=t[i]) {
puts("-1");exit(0);
}
printf("%lld\n",l);
return 0;
}``````

## AtCoder Regular Contest 083 D:Restoring Road Network

In Takahashi Kingdom, which once existed, there are N cities, and some pairs of cities are connected bidirectionally by roads. The following are known about the road network: People traveled between cities only through roads. It was possible to reach

## ZOJ3519-Beautiful People：最长上升子序列的变形

Beautiful People Special JudgeTime Limit: 10000/5000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitStatisticNext Problem Problem Description The most prestigious sports club in one city has exactly N members. Each of its members is

## ZOJ2317-Nice Patterns Strike Back：矩阵快速幂，高精度

Nice Patterns Strike Back Time Limit: 20000/10000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) Problem Description You might have noticed that there is the new fashion among rich people to have their yards tiled with black and white tile

## 2015 Multi-University Training Contest 10 hdu 5406 CRB and Apple

CRB and Apple Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 421    Accepted Submission(s): 131 Problem Description In Codeland there are many apple trees.One day CRB and his girlfriend decide