# L1-001. Hello World

400 ms

65536 kB

8000 B

Standard
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
int main(){
cout<<"Hello World!"<<endl;
}

# L1-002. 打印沙漏

400 ms

65536 kB

8000 B

Standard

*****
***
*
***
*****


19 *


*****
***
*
***
*****
2
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
int main(){
int n;string s;
cin>>n>>s;
int m=1,i=3;
for(;;i+=2){
if(m+i*2>n) break;
m+=i*2;
}
i-=2;
for(int j=0;j<=i/2;j++){
for(int k=0;k<j;k++)
cout<<" ";
for(int k=0;k<i-j*2;k++)
cout<<s;
cout<<endl;
}
for(int j=i/2-1;j>=0;j--){
for(int k=0;k<j;k++)
cout<<" ";
for(int k=0;k<i-j*2;k++)
cout<<s;
cout<<endl;
}
cout<<n-m<<endl;
}

# L1-003. 个位数统计

400 ms

65536 kB

8000 B

Standard

100311


0:2
1:3
3:1
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
int a[11];
int main(){
string s;
cin>>s;
int len=s.length();
for(int i=0;i<len;i++){
a[s[i]-'0']++;
}
for(int i=0;i<=9;i++){
if(a[i]) printf("%d:%d\n",i,a[i]);
}
}

# L1-004. 计算摄氏温度

400 ms

65536 kB

8000 B

Standard

150


Celsius = 65
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
int a[11];
int main(){
int n;
cin>>n;
n=(n-32)*5/9;
cout<<"Celsius = "<<n<<endl;
}

# L1-005. 考试座位号

200 ms

65536 kB

8000 B

Standard

4
10120150912233 2 4
10120150912119 4 1
10120150912126 1 3
10120150912002 3 2
2
3 4


10120150912002 2
10120150912119 1
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
struct Node{
string a,b,c;
}a[10005];
int main(){
int n;
cin>>n;
string x,y,z;
for(int i=1;i<=n;i++){
cin>>x>>y>>z;
a[i].a=x;a[i].b=y;a[i].c=z;
}
int m;
cin>>m;
for(int i=1;i<=m;i++){
cin>>x;
for(int j=1;j<=n;j++){
if(a[j].b==x) cout<<a[j].a<<" "<<a[j].c<<endl;
}
}
}

# L1-006. 连续因子

400 ms

65536 kB

8000 B

Standard

630


3
5*6*7
//2^31为2147483648
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
LL n,m,ans,tmp,cnt=0,cntp=0;
scanf("%lld",&n);
m=LL(sqrt(n))+1;
for(LL i=2;i<=m;i++){
if(n%i==0){
tmp=i;
cntp=1;
for(LL j=i+1;j<=m;j++){
tmp*=j;
if(n%tmp!=0)
break;
cntp++;
}
if(cntp>cnt) cnt=cntp,ans=i;
}
}
if(cnt==0){
printf("1\n%lld\n",n);
}
else{
printf("%lld\n",cnt);
for(LL i=ans;i<ans+cnt-1;i++){
printf("%lld*",i);
}
printf("%lld\n",ans+cnt-1);
}
}


# L1-007. 念数字

时间限制
400 ms
内存限制
65536 kB
代码长度限制
8000 B
判题程序
Standard
作者
翁恺

输入一个整数，输出每个数字对应的拼音。当整数为负数时，先输出“fu”字。十个数字对应的拼音如下：

0: ling
1: yi
2: er
3: san
4: si
5: wu
6: liu
7: qi
8: ba
9: jiu


-600


fu liu ling ling
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
string s[]={"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
string fu="fu";
string a;
cin>>a;
int len=a.length();
for(int i=0;i<len;i++){
if(a[i]=='-') cout<<fu;
else cout<<s[a[i]-'0'];
if(i!=len-1) cout<<" ";
else cout<<endl;
}
}


# L1-008. 求整数段和

时间限制
400 ms
内存限制
65536 kB
代码长度限制
8000 B
判题程序
Standard
作者
杨起帆

给定两个整数A和B，输出从A到B的所有整数以及这些数的和。

输入格式：

输入在一行中给出2个整数A和B，其中-100<=A<=B<=100，其间以空格分隔。

输出格式：

首先顺序输出从A到B的所有整数，每5个数字占一行，每个数字占5个字符宽度，向右对齐。最后在一行中输出全部数字的和。

输入样例：
-3 8


   -3   -2   -1    0    1
2    3    4    5    6
7    8
Sum = 30
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int a,b,sum=0;
cin>>a>>b;
for(int i=a;i<=b;i++){
if((i-a)%5==0&&i>a) cout<<endl;
printf("%5d",i);
sum+=i;
}
printf("\nSum = %d",sum);
}


# L1-009. N个数求和

400 ms

65536 kB

8000 B

Standard

5
2/5 4/15 1/30 -2/60 8/3


3 1/3


2
4/3 2/3


2


3
1/3 -1/6 1/8


7/24
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
LL lcm(LL a,LL b){
return a/__gcd(a,b)*b;
}
int main(){
LL n,fm=1;
LL a[105][2];
string s;
cin>>n;
for(LL i=1;i<=n;i++){
cin>>s;
LL x=0,len=s.length(),flag=1,j;
for(j=0;j<len;j++){
if(s[j]=='-') flag=0;
else if(s[j]=='/') break;
else x=x*10+s[j]-'0';
}
if(flag==0) x=-x;
a[i][0]=x;
if(j==len){
a[i][1]=1;
continue;
}
flag=1,x=0;
for(j++;j<len;j++)
x=x*10+s[j]-'0';
if(flag==0) x=-x;
a[i][1]=x;
fm=lcm(x,fm);
}
LL fz=0;
for(LL i=1;i<=n;i++)
fz+=fm/a[i][1]*a[i][0];
LL ans1=fz/fm,ans2=abs(fz)%fm;
LL t=__gcd(ans2,fm);
ans2/=t;fm/=t;
if(ans1) cout<<ans1;
else if(!ans2) cout<<ans1;
if(ans2){
if(ans1) cout<<" ";
else if(fz<0) ans2=-ans2;
cout<<ans2<<"/"<<fm;
}
cout<<endl;
}


# L1-010. 比较大小

400 ms

65536 kB

8000 B

Standard

4 2 8


2->4->8
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int a[3];
cin>>a[0]>>a[1]>>a[2];
sort(a,a+3);
cout<<a[0]<<"->"<<a[1]<<"->"<<a[2]<<endl;
}


# L1-011. A-B

100 ms

65536 kB

8000 B

Standard

I love GPLT!  It's a fun game!
aeiou


I lv GPLT!  It's  fn gm!
//B字符串可能有空格
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
char c[100005],s[100005];
gets(c);
gets(s);
int a[500];
for(int i=0;i<500;i++) a[i]=1;
int len=strlen(s);
for(int i=0;i<len;i++) a[s[i]]=0;
len=strlen(c);
for(int i=0;i<len;i++){
if(a[c[i]]) cout<<c[i];
}
cout<<endl;
}


# L1-012. 计算指数

400 ms

65536 kB

8000 B

Standard

5


2^5 = 32
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int n;
LL ans=1;
cin>>n;
for(int i=1;i<=n;i++) ans*=2;
cout<<"2^"<<n<<" = "<<ans<<endl;
}


# L1-013. 计算阶乘和

400 ms

65536 kB

8000 B

Standard

3


9
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
LL ans=0,n;
cin>>n;
LL tmp=1;
for(int i=1;i<=n;i++){
tmp*=i;
ans+=tmp;
}
cout<<ans;
}


# L1-014. 简单题

400 ms

65536 kB

8000 B

Standard

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
cout<<"This is a simple problem."<<endl;

}

# L1-015. 跟奥巴马一起画方块

400 ms

65536 kB

8000 B

Standard

10 a


aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int n,m;
string s;
cin>>n>>s;
m=int(floor(1.0*n/2+0.5));
for(int i=1;i<=m;i++){
for(int j=1;j<=n;j++)
cout<<s;
cout<<endl;
}
}


# L1-016. 查验身份证

400 ms

65536 kB

8000 B

Standard

Z：0 1 2 3 4 5 6 7 8 9 10
M：1 0 X 9 8 7 6 5 4 3 2

4
320124198808240056
12010X198901011234
110108196711301866
37070419881216001X


12010X198901011234
110108196711301866
37070419881216001X


2
320124198808240056
110108196711301862


All passed

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int v[]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};
char m[]="10X98765432";
int n;
cin>>n;
string s;
vector<string>ans;

for(int i=1;i<=n;i++){
cin>>s;int sum=0;
for(int j=0;j<17;j++){
int x=0;
if(s[j]=='X') x=10;
else x=s[j]-'0';
sum+=x*v[j];
}
sum=sum%11;
if(m[sum]!=s[17]) ans.push_back(s);
}
if(ans.size())
for(int i=0;i<ans.size();i++)
cout<<ans[i]<<endl;
else cout<<"All passed"<<endl;
}

# L1-017. 到底有多二

400 ms

65536 kB

8000 B

Standard

-13142223336


81.82%
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
string s;
cin>>s;
int len=s.length();
int i=0;
double fu=1,fd=1;
if(s[0]=='-') i++,fu=1.5;
double ans=0;
for(;i<len;i++)
if(s[i]=='2') ans++;
if((s[len-1]-'0')%2==0) fd=2;
ans=ans/len*fu*fd*100;
printf("%.2f%%\n",ans);
}


# L1-018. 大笨钟

400 ms

65536 kB

8000 B

Standard

Only hh:mm.  Too early to Dang.


19:05


DangDangDangDangDangDangDangDang


07:05


Only 07:05.  Too early to Dang.
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
string s;
cin>>s;
int h=s[1]-'0'+(s[0]-'0')*10;
int f=s[4]-'0'+(s[3]-'0')*10;
if(f) h++;
if(h<=12) cout<<"Only "<<s<<".  Too early to Dang."<<endl;
else{
h-=12;
for(int i=1;i<=h;i++)
cout<<"Dang";
cout<<endl;
}
}


# L1-019. 谁先倒

400 ms

65536 kB

8000 B

Standard

1 1
6
8 10 9 12
5 10 5 10
3 8 5 12
12 18 1 13
4 16 12 15
15 1 1 16


A
1
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int a,b;
cin>>a>>b;
int n;
int a1,a2,b1,b2;
int cnta=0,cntb=0;
int ans1=0,ans2;
cin>>n;
while(n--){
cin>>a1>>a2>>b1>>b2;
if(!ans1){
if(a1+b1==a2&&a1+b1!=b2) cnta++;
else if(a1+b1!=a2&&a1+b1==b2) cntb++;
if(cnta>a) ans1=1,ans2=cntb;
else if(cntb>b) ans1=2,ans2=cnta;
}
}
cout<<char(ans1+'A'-1)<<endl;
cout<<ans2<<endl;
}


# L1-020. 帅到没朋友

200 ms

65536 kB

8000 B

Standard

3
3 11111 22222 55555
2 33333 44444
4 55555 66666 99999 77777
8
55555 44444 10000 88888 22222 11111 23333 88888


10000 88888 23333


3
3 11111 22222 55555
2 33333 44444
4 55555 66666 99999 77777
4
55555 44444 22222 11111


No one is handsome
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int a[100005];
int main(){
int n,m,x;
cin>>n;
while(n--){
cin>>m;
for(int i=1;i<=m;i++){
cin>>x;
if(m>1) a[x]=1;
}
}
cin>>m;
int first=1;
while(m--){
cin>>x;
if(!a[x]){
if(first) first=0;
else cout<<" ";
printf("%05d",x);
a[x]=1;
}
}
if(first) cout<<"No one is handsome";
cout<<endl;
}


# L1-021. 重要的话说三遍

400 ms

65536 kB

8000 B

Standard

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int a[100005];
int main(){
cout<<"I'm gonna WIN!"<<endl;
cout<<"I'm gonna WIN!"<<endl;
cout<<"I'm gonna WIN!"<<endl;

}

# L1-022. 奇偶分家

400 ms

65536 kB

8000 B

Standard

9
88 74 101 26 15 0 34 22 77


3 6
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int n,x,ans1=0,ans2=0;
cin>>n;
while(n--){
cin>>x;
if(x%2) ans1++;
else ans2++;
}
cout<<ans1<<" "<<ans2<<endl;
}


# L1-023. 输出GPLT

150 ms

65536 kB

8000 B

Standard

pcTclnGloRgLrtLhgljkLhGFauPewSKgt


GPLTGPLTGLTGLGLL
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
string s;
cin>>s;
int len=s.length();
int g=0,p=0,l=0,t=0;
for(int i=0;i<len;i++){
if(s[i]=='G'||s[i]=='g') g++;
else if(s[i]=='P'||s[i]=='p') p++;
else if(s[i]=='L'||s[i]=='l') l++;
else if(s[i]=='T'||s[i]=='t') t++;
}
while(g||p||l||t){
if(g) cout<<'G',g--;
if(p) cout<<'P',p--;
if(l) cout<<'L',l--;
if(t) cout<<'T',t--;
}
cout<<endl;
}


# L1-024. 后天

400 ms

65536 kB

8000 B

Standard

3


5
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int n;
cin>>n;
n+=2;if(n>7) n-=7;
cout<<n<<endl;

}

# L1-025. 正整数A+B

400 ms

65536 kB

8000 B

Standard

123 456


123 + 456 = 579


22. 18


? + 18 = ?


-100 blabla bla...33


? + ? = ?
//a和b都以第一个空格分隔，多出的空格属于字符串b
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
string a,b,c="";
cin>>a>>b;
while(cin>>c);
int aa=0,bb=0;
int la=a.length(),lb=b.length();
for(int i=0;i<la;i++){
if(a[i]>'9'||a[i]<'0'){aa=-1;break;}
aa=aa*10+a[i]-'0';
}
for(int i=0;i<lb;i++){
if(b[i]>'9'||b[i]<'0'){bb=-1;break;}
bb=bb*10+b[i]-'0';
}
if(c!="") bb=-1;
if(aa>=1&&aa<=1000) cout<<aa;else cout<<'?';
cout<<" + ";
if(bb>=1&&bb<=1000) cout<<bb;else cout<<'?';
cout<<" = ";
if(aa>=1&&aa<=1000&&bb>=1&&bb<=1000) cout<<aa+bb<<endl;
else cout<<'?'<<endl;
}


# L1-026. I Love GPLT

400 ms

65536 kB

8000 B

Standard

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
string a="I Love GPLT";
int n=a.length();
for(int i=0;i<n;i++) cout<<a[i]<<endl;
}


# L1-027. 出租

400 ms

65536 kB

8000 B

Standard

18013820100


int[] arr = new int[]{8,3,2,1,0};
int[] index = new int[]{3,0,4,3,1,0,2,4,3,4,4};
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int vis[15];
int main(){
string s;
cin>>s;
int len=s.length();
for(int i=0;i<len;i++){
vis[s[i]-'0']++;
}
int a[15],cnt=0;
printf("int[] arr = new int[]{");
for(int i=9;i>=0;i--)
if(vis[i]){
a[i]=cnt++;
if(cnt!=1) printf(",");
printf("%d",i);

}
printf("};\n");
printf("int[] index = new int[]{");
for(int i=0;i<len;i++){
if(i!=0) printf(",");
printf("%d",a[s[i]-'0']);
}
printf("};\n");
}


# L1-028. 判断素数

400 ms

65536 kB

8000 B

Standard

2
11
111


Yes
No
//for(i=2;i*i<=x;i++)这样写会TLE
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int n,x;
scanf("%d",&n);
while(n--){
scanf("%d",&x);
if(x==1) puts("No");
else{
int i;
for(i=2;i<=sqrt(x);i++){
if(x%i==0){
puts("No");
break;
}
}
if(i>sqrt(x)) puts("Yes");
}
}
}


# L1-029. 是不是太胖了

400 ms

65536 kB

8000 B

Standard

169


124.2
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
double a;
cin>>a;
a-=100;a*=1.8;
printf("%.1f\n",a);
}


# L1-030. 一帮一

400 ms

65536 kB

8000 B

Standard

“一帮一学习小组”是中小学中常见的学习组织方式，老师把学习成绩靠前的学生跟学习成绩靠后的学生排在一组。本题就请你编写程序帮助老师自动完成这个分配工作，即在得到全班学生的排名后，在当前尚未分组的学生中，将名次最靠前的学生与名次最靠后的异性学生分为一组。

8
0 Amy
1 Tom
1 Bill
0 Cindy
0 Maya
1 John
1 Jack
0 Linda


Amy Jack
Tom Linda
Bill Maya
Cindy John
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int n;
string s[60],girl[60],boy[60];
int a[60];
int ng=0,nb=0;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i]>>s[i];
if(a[i]) girl[++ng]=s[i];
else boy[++nb]=s[i];
}
for(int i=1;i<=n/2;i++){
if(a[i]==1) cout<<s[i]<<" "<<boy[nb--]<<endl;
else cout<<s[i]<<" "<<girl[ng--]<<endl;
}
}


400 ms

65536 kB

8000 B

Standard

15 _
I love GPLT


____I love GPLT


4 *
this is a sample for cut


 cut
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
char s[1000005];
int main(){
int n;
string x;
cin>>n>>x;
getchar();gets(s);
int m=strlen(s);
if(m>n)
for(int i=m-n;i<m;i++)
cout<<s[i];
else{
for(int i=1;i<=n-m;i++)
cout<<x;
cout<<s;
}
cout<<endl;
}


# L1-033. 出生年

400 ms

65536 kB

8000 B

Standard

1988 4


25 2013


1 2


0 0001
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int n,m,vis[20];
cin>>n>>m;
int nn=n;
while(1){
memset(vis,0,sizeof(vis));
int a=nn/1000,b=(nn-a*1000)/100,c=(nn/10)%10,d=nn%10;
vis[a]=1,vis[b]=1,vis[c]=1,vis[d]=1;
int cnt=0;
for(int i=0;i<=9;i++) cnt+=vis[i];
if(cnt==m){
printf("%d %04d",nn-n,nn);
break;
}
nn++;
}
}


# L1-034. 点赞

200 ms

65536 kB

8000 B

Standard

4
3 889 233 2
5 100 3 233 2 73
4 3 73 889 2
2 233 123


233 3
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int a[10005];
int main(){
int n,m,x,ans=-1,anst=-1;
cin>>n;
while(n--){
cin>>m;
while(m--){
cin>>x;
a[x]++;
if(a[x]>anst||(a[x]==anst&&x>ans))
anst=a[x],ans=x;
}
}
cout<<ans<<" "<<anst<<endl;
}


# L1-035. 情人节

400 ms

65536 kB

8000 B

Standard

GaoXZh
Magi
Einst
Quark
LaoLao
FatMouse
ZhaShen
fantacy
latesum
SenSen
QuanQuan
whatever
whenever
Potaty
hahaha
.


Magi and Potaty are inviting you to dinner...


LaoLao
FatMouse
whoever
.


FatMouse is the only one for you...


LaoLao
.


Momo... No one is for you ...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
string s,a,b;
int cnt=0;
while(cin>>s){
if(s==".") break;
cnt++;
if(cnt==2) a=s;
else if(cnt==14) b=s;
if(cnt>15) cnt=15;
}
if(cnt<2) cout<<"Momo... No one is for you ..."<<endl;
else if(cnt>=14) cout<<a<<" and "<<b<<" are inviting you to dinner..."<<endl;
else cout<<a<<" is the only one for you..."<<endl;
}


# L1-036. A乘以B

400 ms

65536 kB

8000 B

Standard

-8 13


-104
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int a,b;
cin>>a>>b;
cout<<a*b<<endl;
}


# L1-037. A除以B

400 ms

65536 kB

8000 B

Standard

-1 2


-1/2=-0.50


1 -3


1/(-3)=-0.33


5 0


5/0=Error
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int a,b;
cin>>a>>b;
if(b==0) printf("%d/0=Error\n",a);
else if(b<0) printf("%d/(%d)=%.2f\n",a,b,1.0*a/b);
else printf("%d/%d=%.2f\n",a,b,1.0*a/b);
}


# L1-038. 新世界

400 ms

65536 kB

8000 B

Standard

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
cout<<"Hello World"<<endl;
cout<<"Hello New World"<<endl;
}


# L1-039. 古风排版

400 ms

65536 kB

8000 B

Standard

4
This is a test case


asa T
st ih
e tsi
ce s
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int n;
char s[1005];
cin>>n;
getchar();gets(s);
int len=strlen(s);
for(int i=0;i<=n;i++) s[len+i]=' ';
int c=len/n+(len%n!=0);
char ans[105][105];
int now=0;
for(int j=c;j>=1;j--)
for(int i=1;i<=n;i++)
ans[i][j]=s[now++];
for(int i=1;i<=n;i++){
for(int j=1;j<=c;j++)
cout<<ans[i][j];
cout<<endl;
}

}


# L1-040. 最佳情侣身高差

400 ms

65536 kB

8000 B

Standard

2
M 1.75
F 1.8


1.61
1.96
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int n;
string s;
double x;
cin>>n;
while(n--){
cin>>s>>x;
if(s=="F") printf("%.2f\n",x*1.09);
else printf("%.2f\n",x/1.09);
}
}


# L1-041. 寻找250

400 ms

65536 kB

8000 B

Standard

888 666 123 -233 250 13 250 -222


5
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int x,ans=-1,cnt=0;
while(cin>>x){
cnt++;
if(ans==-1&&x==250)
ans=cnt;
}
cout<<ans<<endl;
}


# L1-042. 日期格式化

400 ms

65536 kB

8000 B

Standard

03-15-2017


2017-03-15
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
string s;
cin>>s;
cout<<s[6]<<s[7]<<s[8]<<s[9]<<'-'<<s[0]<<s[1]<<'-'<<s[3]<<s[4]<<endl;
}


# L1-043. 阅览室

400 ms

65536 kB

8000 B

Standard

3
1 S 08:10
2 S 08:35
1 E 10:00
2 E 13:16
0 S 17:00
0 S 17:00
3 E 08:10
1 S 08:20
2 S 09:00
1 E 09:20
0 E 17:00


2 196
0 0
1 60
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int a[1005],n,k,t,av,cnt;
int ans[15][2],num=0;
string x,s;
cin>>n;
while(n--){
cnt=0,av=0;
memset(a,-1,sizeof(a));
while(cin>>k>>x>>s){
if(k==0) break;
int t=(s[1]-'0'+(s[0]-'0')*10)*60+s[4]-'0'+10*(s[3]-'0');
if(a[k]>=0&&x=="E")
av+=t-a[k],cnt++,a[k]=-1;
else a[k]=t;
}
ans[++num][0]=cnt,ans[num][1]=cnt?int(floor(1.0*av/cnt+0.5)):0;
}
for(int i=1;i<=num;i++)
cout<<ans[i][0]<<" "<<ans[i][1]<<endl;
}


# L1-044. 稳赢

400 ms

65536 kB

8000 B

Standard

2
ChuiZi
JianDao
Bu
JianDao
Bu
ChuiZi
ChuiZi
End


Bu
ChuiZi
Bu
ChuiZi
JianDao
ChuiZi
Bu
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int n,cnt=0;
string s;
cin>>n;
while(cin>>s){
if(s=="End") break;
cnt++;
if(cnt>n){
cout<<s<<endl;
cnt=0;
}
else if(s=="ChuiZi") cout<<"Bu"<<endl;
else if(s=="Bu") cout<<"JianDao"<<endl;
else cout<<"ChuiZi"<<endl;
}
}


# L1-045. 宇宙无敌大招呼

400 ms

65536 kB

8000 B

Standard

Mars


Hello Mars
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
string s;
cin>>s;
cout<<"Hello "<<s<<endl;
}


# L1-046. 整除光棍

400 ms

65536 kB

8000 B

Standard

31


3584229390681 15
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
LL n;
cin>>n;
LL a=1,cnt=1,ans=0,first=0;
while(a%n){
if(first||a/n) first=1,cout<<a/n;
a=a%n;a=a*10+1;
cnt++;
}
if(a/n) cout<<a/n;
ans=ans*10+a/n;
cout<<" "<<cnt<<endl;
}


# L1-047. 装睡

400 ms

65536 kB

8000 B

Standard

4
Amy 15 70
Tom 14 60
Joe 18 50
Zoe 21 71


Tom
Zoe
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int n;
cin>>n;
string s;
int a,b;
vector<string> ans;
while(n--){
cin>>s>>a>>b;
if(a<15||a>20||b<50||b>70) ans.push_back(s);
}
for(int i=0;i<ans.size();i++) cout<<ans[i]<<endl;
}


# L1-048. 矩阵A乘以B

400 ms

65536 kB

8000 B

Standard

2 3
1 2 3
4 5 6
3 4
7 8 9 0
-1 -2 -3 -4
5 6 7 8


2 4
20 22 24 16
53 58 63 28


3 2
38 26
43 -5
0 17
3 2
-11 57
99 68
81 72


Error: 2 != 3
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <math.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int n1,m1,n2,m2;
int a[105][105];
int b[105][105];
int c[105][105];
cin>>n1>>m1;
for(int i=1;i<=n1;i++)
for(int j=1;j<=m1;j++)
cin>>a[i][j];
cin>>n2>>m2;
for(int i=1;i<=n2;i++)
for(int j=1;j<=m2;j++)
cin>>b[i][j];
if(m1!=n2){
printf("Error: %d != %d\n",m1,n2);
return 0;
}
for(int i=1;i<=n1;i++){
int tmp=0;
for(int j=1;j<=m2;j++){
for(int k=1;k<=n2;k++){
tmp+=a[i][k]*b[k][j];
}
c[i][j]=tmp;
}
}
cout<<n1<<" "<<m2<<endl;
for(int i=1;i<=n1;i++){
for(int j=1;j<m2;j++)
cout<<c[i][j]<<" ";
cout<<c[i][m2]<<endl;
}

}


• 1
点赞
• 0
评论
• 2
收藏
• 一键三连
• 扫一扫，分享海报

06-01 1466

03-28 130
03-21 816
03-31 301
12-24 2514
02-23 2560
12-29 5490
03-20 760
07-25 2924
06-16 3311