AtCoder Beginner Contest 070
来源:互联网 发布:mysql如何导出sql文件 编辑:程序博客网 时间:2024/05/17 19:16
Time limit : 2sec / Memory limit : 256MB
Score : 100 points
Problem Statement
You are given a three-digit positive integer N.
Determine whether N is a palindromic number.
Here, a palindromic number is an integer that reads the same backward as forward in decimal notation.
Constraints
100≤N≤999
N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
If N is a palindromic number, print Yes; otherwise, print No.
Sample Input 1
575
Sample Output 1
Yes
N=575 is also 575 when read backward, so it is a palindromic number. You should print Yes.
Sample Input 2
123
Sample Output 2
No
N=123 becomes 321 when read backward, so it is not a palindromic number. You should print No.
Sample Input 3
812
Sample Output 3
No
小小翻译一下就是判断一下输入的数字是否是回文
#include<iostream>using namespace std;int main(){int n,t,sum; while(cin>>n) { sum=0; t=n; while(n) { sum=sum*10+n%10; n/=10; } if(t==sum) cout<<"Yes"<<endl; else cout<<"No"<<endl; }}B - Two Switches
Time limit : 2sec / Memory limit : 256MB
Score : 200 points
Problem Statement
Alice and Bob are controlling a robot. They each have one switch that controls the robot.
Alice started holding down her button A second after the start-up of the robot, and released her button B second after the start-up.
Bob started holding down his button C second after the start-up, and released his button D second after the start-up.
For how many seconds both Alice and Bob were holding down their buttons?
Constraints
0≤A<B≤100
0≤C<D≤100
All input values are integers.
Input
Input is given from Standard Input in the following format:
A B C D
Output
Print the length of the duration (in seconds) in which both Alice and Bob were holding down their buttons.
Sample Input 1
0 75 25 100
Sample Output 1
50
Alice started holding down her button 0 second after the start-up of the robot, and released her button 75 second after the start-up.
Bob started holding down his button 25 second after the start-up, and released his button 100 second after the start-up.
Therefore, the time when both of them were holding down their buttons, is the 50 seconds from 25 seconds after the start-up to 75 seconds after the start-up.
Sample Input 2
0 33 66 99
Sample Output 2
0
Alice and Bob were not holding their buttons at the same time, so the answer is zero seconds.
Sample Input 3
10 90 20 80
Sample Output 3
60
整体意思就是A-B,C-D的时间段内,两个时间段的交集
#include<iostream>using namespace std;int a[110]={0};int main(){int A,B,C,D,sum=0;cin>>A>>B>>C>>D;for(int i=0;i<=110;i++){if(i>=A&&i<B)a[i]++;if(i>=C&&i<D)a[i]++;}for(int i=0;i<=110;i++){if(a[i]==2)sum++;}cout<<sum<<endl; }
C - Multiple Clocks
Time limit : 2sec / Memory limit : 256MB
Score : 300 points
Problem Statement
We have N clocks. The hand of the i-th clock (1≤i≤N) rotates through 360° in exactly Ti seconds.
Initially, the hand of every clock stands still, pointing directly upward.
Now, Dolphin starts all the clocks simultaneously.
In how many seconds will the hand of every clock point directly upward again?
Constraints
- 1≤N≤100
- 1≤Ti≤1018
- All input values are integers.
- The correct answer is at most 1018 seconds.
Input
Input is given from Standard Input in the following format:
NT1: TN
Output
Print the number of seconds after which the hand of every clock point directly upward again.
Sample Input 1
223
Sample Output 1
6
We have two clocks. The time when the hand of each clock points upward is as follows:
- Clock 1: 2, 4, 6, … seconds after the beginning
- Clock 2: 3, 6, 9, … seconds after the beginning
Therefore, it takes 6 seconds until the hands of both clocks point directly upward.
Sample Input 2
5251010000000000000000001000000000000000000
Sample Output 2
1000000000000000000
#include<iostream>using namespace std;int main(){long long int n,c=1,m,t,temp;cin>>n;for(int i=0;i<n;i++){cin>>t;if(t>c){temp=c;c=t;t=temp;}long long int k,l;k=t;l=c;while(t!=0){temp=c%t;c=t;t=temp;}c=k/c*l;//数据太大,所以先除后乘}cout<<c<<endl;}
- AtCoder Beginner Contest 070
- AtCoder Beginner Contest 070-D
- AtCoder Beginner Contest 070 D
- AtCoder Beginner Contest 070 Transit Tree Path
- AtCoder Beginner Contest 070 ABC C++&&python
- AtCoder Beginner Contest 055
- AtCoder Beginner Contest 052
- AtCoder Beginner Contest 057
- AtCoder Beginner Contest 063
- AtCoder Beginner Contest 069
- AtCoder Beginner Contest 069
- AtCoder Beginner Contest 072
- AtCoder Beginner Contest 072
- AtCoder Beginner Contest 072
- AtCoder Beginner Contest 073
- AtCoder Beginner Contest 072
- AtCoder Beginner Contest 075
- AtCoder Beginner Contest 081
- SPOJ D-query(区间不同的数的个数)
- 爬虫实践---悦音台mv排行榜与简单反爬虫技术应用
- 简单Cookie应用
- 作业
- (17)触发器trigger
- AtCoder Beginner Contest 070
- 今天正式写博客啦
- 刷题——Yogurt factory POJ
- Codeforces-834D The Bakery 线段树优化DP
- javascript年月日三级联动下拉框
- 8.14 免费的午餐 2692
- C++ SetTimer
- [bzoj1854][Scoi2010]游戏
- sin之舞