#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
}
#include<iostream>
using namespace std;
int f[1111];
int main()
{
int n,m,v,w;
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>v>>w;
for(int j=m;j>=v;j--)
f[j]=max(f[j],f[j-v]+w);
}
cout<<f[m];
}
#include<iostream>
using namespace std;
int f[1111];
int main()
{
int n,m,v,w;
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>v>>w;
for(int j=v;j<=m;j++)
f[j]=max(f[j],f[j-v]+w);
}
cout<<f[m];
}
#include<iostream>
using namespace std;
int main()
{
double a;
cin>>a;
printf("A=%.4f",a*a*3.14159);
}
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<"PROD = "<<a*b;
}
#include<iostream>
using namespace std;
int main()
{
double a,b;
cin>>a>>b;
printf("MEDIA = %.5f",(a*3.5+b*7.5)/11);
}
#include<iostream>
using namespace std;
int main()
{
double a,b,c;
cin>>a>>b>>c;
printf("MEDIA = %.1f",(a*2+b*3+c*5)/10);
}
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d;
cin>>a>>b>>c>>d;
cout<<"DIFERENCA = "<<a*b-c*d;
}
#include<iostream>
using namespace std;
int main()
{
int a,b;
double c;
cin>>a>>b>>c;
printf("NUMBER = %d\n",a);
printf("SALARY = U$ %.2f",b*c);
}
#include<iostream>
using namespace std;
int main()
{
string a;
double x,y;
cin>>a>>x>>y;
printf("TOTAL = R$ %.2f",x+y*0.15);
}
#include<iostream>
using namespace std;
int main()
{
double a,b,c,d,e,f;
cin>>a>>b>>c>>d>>e>>f;
printf("VALOR A PAGAR: R$ %.2f",b*c+e*f);
}
#include<iostream>
using namespace std;
int main()
{
int a;
cin>>a;
printf("VOLUME = %.3f",(4*3.14159*a*a*a)/3);
}
#include<iostream>
using namespace std;
int main()
{
double a,b,c;
cin>>a>>b>>c;
printf("TRIANGULO: %.3f\n",a*c/2);
printf("CIRCULO: %.3f\n",c*c*3.14159);
printf("TRAPEZIO: %.3f\n",(a+b)*c/2);
printf("QUADRADO: %.3f\n",b*b);
printf("RETANGULO: %.3f\n",a*b);
}
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
cout<<max(a,max(b,c))<<" eh o maior";
}
#include<iostream>
using namespace std;
int main()
{
double a,b;
cin>>a>>b;
printf("%.3f km/l",a/b);
}
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double a,b,c,d;
cin>>a>>b>>c>>d;
printf("%.4f",sqrt(pow(a-c,2)+pow(b-d,2)));
}
#include<iostream>
using namespace std;
int main()
{
int a;
cin>>a;;
cout<<a*2<<" minutos";
}
#include<iostream>
using namespace std;
int main()
{
double a,b;
cin>>a>>b;
printf("%.3f",a*b/12);
}
#include<iostream>
using namespace std;
int a[7]={100,50,20,10,5,2,1};
int main()
{
int n;
cin>>n;
cout<<n<<endl;
for(int i=0;i<7;i++)
{
printf("%d nota(s) de R$ %d,00\n",n/a[i],a[i]);
n=n%a[i];
}
}
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
printf("%d:%d:%d",n/3600,n%3600/60,n%3600%60);
}
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
cout<<n/365<<" ano(s)"<<endl<<n%365/30<<" mes(es)"<<endl<<n%365%30<<" dia(s)";
}
#include<iostream>
using namespace std;
int a[6]= {100,50,20,10,5,2};
int b[6]={100,50,25,10,5,1};
int main()
{
double n;
cin>>n;
int m=n*100;
cout<<"NOTAS:"<<endl;
for(int i=0;i<6;i++)
{
printf("%d nota(s) de R$ %.2f\n",m/a[i]/100,(double)a[i]);
m%=a[i]*100;
}
cout<<"MOEDAS:"<<endl;
for(int i=0;i<6;i++)
{
printf("%d moeda(s) de R$ %.2f\n",m/b[i],b[i]/100.0);
m%=b[i];
}
}
#include <iostream>
using namespace std;
int main()
{
int a,b,c,d;
cin>>a>>b>>c>>d;
cout<<(b>c&&d>a&&c+d>a+b&&c>0&&d>0&&a%2==0 ? "Valores aceitos" : "Valores nao aceitos");
return 0;
}
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double a,b,c,d;
cin>>a>>b>>c;
d=b*b-a*4*c;
if(d<0||a==0)cout<<"Impossivel calcular";
else
printf("R1 = %.5f\nR2 = %.5f",(-b+sqrt(d))/2/a,(-b-sqrt(d))/2/a);
}
#include <iostream>
using namespace std;
int main()
{
double x;
cin>>x;
if(x>=0&&x<=100)
{
if(x<=25) cout<<"Intervalo [0,25]";
else if(x<=50) cout<<"Intervalo (25,50]";
else if(x<=75) cout<<"Intervalo (50,75]";
else if(x<=100) cout<<"Intervalo (75,100]";
}
else cout<<"Fora de intervalo";
}
#include<iostream>
using namespace std;
double a[6]={0,4,4.5,5,2,1.5};
int main()
{
int n,m;
cin>>n>>m;
printf("Total: R$ %.2f",a[n]*m);
}
#include<iostream>
using namespace std;
int main()
{
double a,b,c,d;
cin>>a>>b>>c>>d;
double x=(a*2+b*3+c*4+d*1)/10,y;
printf("Media: %.1f\n",x);
if(x>7)printf("Aluno aprovado.\n");
if(x<5)printf("Aluno reprovado.\n");
if(x>=5&&x<=7)
{
printf("Aluno em exame.\n");
cin>>y;
printf("Nota do exame: %.1f\n",y);
double z=(x+y)/2;
if(z>=5)
printf("Aluno aprovado.\n");
else
printf("Aluno reprovado.\n");
printf("Media final: %.1f\n",z);
}
}
#include <iostream>
using namespace std;
int main()
{
double x,y;
cin>>x>>y;
if(x==0&&y==0) cout<<"Origem";
else if(x*y==0) cout<<(x==0?"Eixo Y":"Eixo X");
else if(x>0)cout<<(y>0?"Q1":"Q4");
else cout<<(y>0?"Q2":"Q3");
}
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
int x=max(a,max(b,c));
int y=min(a,min(b,c));
int z=a+b+c-x-y;
//cout<<y<<endl<<z<<endl<<x<<endl<<endl<<a<<endl<<b<<endl<<c;
printf("%d\n%d\n%d\n\n%d\n%d\n%d\n",y,z,x,a,b,c);
}
#include<iostream>
using namespace std;
int main()
{
double a,b,c;
cin>>a>>b>>c;
if(a+b>c&&b+c>a&&a+c>b)
printf("Perimetro = %.1f",a+b+c);
else
printf("Area = %.1f",(a+b)*c/2);
}
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
if(!(a%b)||!(b%a))
cout<<"Sao Multiplos";
else
cout<<"Nao sao Multiplos";
}
#include<iostream>
#include<algorithm>
using namespace std;
double a[3];
int main()
{
for(int i=0;i<3;i++)
cin>>a[i];
sort(a,a+3);
if(a[2]>=a[0]+a[1])printf("NAO FORMA TRIANGULO\n");
else
{
if(a[2]*a[2]==a[0]*a[0]+a[1]*a[1])printf("TRIANGULO RETANGULO\n");
else if(a[2]*a[2]>a[0]*a[0]+a[1]*a[1])printf("TRIANGULO OBTUSANGULO\n");
else if(a[2]*a[2]<a[0]*a[0]+a[1]*a[1])printf("TRIANGULO ACUTANGULO\n");
if(a[0]==a[1]&&a[1]==a[2])printf("TRIANGULO EQUILATERO\n");
else if(a[0]==a[1]||a[1]==a[2])printf("TRIANGULO ISOSCELES\n");
}
}
#include <iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
if(b<=a)b+=24;
printf("O JOGO DUROU %d HORA(S)",b-a);
}
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d;
cin>>a>>b>>c>>d;
int bj=0;
if(d==b)bj=1;
if(d<b)c-=1,bj=1,d+=60;
if(c<=a&&bj)c+=24;
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)",c-a,d-b);
}
#include<iostream>
using namespace std;
int main()
{
double n,x,ans;
cin>>n;
if(n<=400)x=0.15;
else if(n<=800)x=0.12;
else if(n<=1200)x=0.1;
else if(n<=2000)x=0.07;
else x=0.04;
ans=n*x;
printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: %.0f %\n",ans+n,ans,x*100);
}
#include <iostream>
using namespace std;
string a[3];
int main()
{
string ss;
for(int i=0;i<3;i++) cin >> a[i],ss+=a[i][0];
if(ss=="vac") cout<<"aguia";
if(ss=="vao") cout<<"pomba";
if(ss=="vmo") cout<<"homem";
if(ss=="vmh") cout<<"vaca";
if(ss=="iih")
{
if(a[2]=="hematofago") cout<<"pulga";
else cout<<"lagarta";
}
if(ss=="iah") cout<<"sanguessuga";
if(ss=="iao") cout<<"minhoca";
}
#include<iostream>
using namespace std;
int main()
{
string s[8]={"Brasilia","Salvador","Sao Paulo","Rio de Janeiro","Juiz de Fora","Campinas","Vitoria","Belo Horizonte"};
int a[8]={61,71,11,21,32,19,27,31};
int n,bj=0;
cin>>n;
for(int i=0;i<8;i++)
{
if(n==a[i])
{
cout<<s[i];
bj=1;
}
}
if(!bj)cout<<"DDD nao cadastrado";
}
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
double a;
cin>>a;
if(a<=2000)
printf("Isento");
if(a>2000&&a<=3000)
printf("R$ %.2f",(a-2000)*0.08);
if(a>3000&&a<=4500)
printf("R$ %.2f",1000*0.08+(a-3000)*0.18);
if(a>4500)
printf("R$ %.2f",1000*0.08+1500*0.18+(a-4500)*0.28);
}
#include<iostream>
using namespace std;
int main()
{
for(int i=2;i<=100;i+=2)
cout<<i<<endl;
}
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i+=2)
cout<<i<<endl;
}
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(n%2==0)n++;
for(int i=0;i<6;i++)
cout<<n+i*2<<endl;
}
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=10;i++)
printf("%d x %d = %d\n",i,n,i*n);
}
#include<iostream>
using namespace std;
double n,i,j=6;
int main()
{
while(j--)
{
cin>>n;
if(n>0)i++;
}
cout<<i<<" positive numbers";
}
#include<iostream>
using namespace std;
int main()
{
int n,x,cnt=0;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>x;
if(x>=10&&x<=20)cnt++;
}
printf("%d in\n%d out",cnt,n-cnt);
}
#include<iostream>
using namespace std;
int main()
{
int sum=0,x,y;
cin>>x>>y;
for(int i=min(x,y)+1;i<max(x,y);i++)
{
if(i&1)
sum+=i;
}
cout<<sum;
}
#include<iostream>
using namespace std;
int main()
{
int n,m=2;
cin>>n;
while(m<10000)
{
cout<<m<<endl;
m+=n;
}
}
#include<iostream>
using namespace std;
int main()
{
int a,b,x;
for(int i=1;i<=100;i++)
{
cin>>x;
if(x>b)a=i,b=x;
}
cout<<b<<endl<<a;
}
#include<iostream>
using namespace std;
int n,a,b=1,c;
int main()
{
cin>>n;
while(n--)
{
cout<<a<<" ";
c=a+b;
a=b;
b=c;
}
}
#include<iostream>
using namespace std;
double n,x,c,r,f;
char ss;
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>x>>ss;
if(ss=='C')c+=x;
else if(ss=='R')r+=x;
else f+=x;
}
double s=c+r+f;
printf("Total: %.0f animals\nTotal coneys: %.0f\nTotal rats: %.0f\nTotal frogs: %.0f\nPercentage of coneys: %.2f %\nPercentage of rats: %.2f %\nPercentage of frogs: %.2f %",s,c,r,f,c/s*100,r/s*100,f/s*100);
}
#include<iostream>
using namespace std;
int main()
{
int n,sum=0,x,y;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>x>>y;
for(int j=min(x,y)+1;j<max(x,y);j++)
{
if(j&1)
sum+=j;
}
cout<<sum<<endl;
sum=0;
}
}
#include<iostream>
using namespace std;
int main()
{
int n,a;
cin>>a;
while(cin>>n,n<=0);
cout<<(a+a+n-1)*n/2;
}
#include<iostream>
using namespace std;
int main()
{
int n;
while(cin>>n,n)
{
for(int i=1;i<=n;i++)cout<<i<<" ";
puts("");
}
}
#include<iostream>
using namespace std;
int main()
{
int a,b;
while(cin>>a>>b,a>0&&b>0)
{
int s=0;
for(int i=min(a,b);i<=max(a,b);i++)
cout<<i<<" ",s+=i;
cout<<"Sum="<<s<<endl;
}
}
#include<iostream>
using namespace std;
int main()
{
int n,m,cnt=0;
cin>>n>>m;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
cnt++;
if(j==m)
cout<<"PUM"<<endl;
else
cout<<cnt<<" ";
}
}
}
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
if(n%i==0)
cout<<i<<endl;
}
}
#include<iostream>
using namespace std;
int main()
{
int n,x;
cin>>n;
while(n--)
{
int s=0;
cin>>x;
for(int i=1;i<=x/i;i++)
{
if(x%i==0)
{
if(i<x)s+=i;
if(x/i<x)s+=x/i;
}
}
if(x==s)
printf("%d is perfect\n",x);
else
printf("%d is not perfect\n",x);
}
}
#include<iostream>
using namespace std;
bool pd(int x)
{
for(int i=2;i*i<=x;i++)
if(x%i==0)return false;
return true;
}
int main()
{
int n;
cin>>n;
while(n--)
{
int x;
cin>>x;
if(pd(x))printf("%d is prime\n",x);
else printf("%d is not prime\n",x);
}
}
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
n/=2;
for(int i=-n;i<=n; i ++)
{
for(int j=0;j<abs(i);j++)
printf(" ");
for(int j=0;j<2*(n-abs(i))+1;j++)
printf("*");
puts("");
}
}
#include<iostream>
using namespace std;
int main()
{
int n;
for(int i=0;i<10;i++)
{
cin>>n;
if(n<=0)n=1;
printf("X[%d] = %d\n",i,n);
}
}
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=0;i<10;i++)
{
printf("N[%d] = %d\n",i,n);n*=2;
}
}
#include<iostream>
using namespace std;
double n;
int main()
{
for(int i=0;i<100;i++)
{
cin>>n;
if(n<=10)
printf("A[%d] = %.1f\n",i,n);
}
}
#include<iostream>
using namespace std;
int main()
{
int a[50];
for(int i=19;i>=0;i--)cin>>a[i];
for(int i=0;i<20;i++)printf("N[%d] = %d\n",i,a[i]);
}
#include<iostream>
using namespace std;
int main()
{
int n,t;
cin>>t;
while(t--)
{
cin>>n;
long long a=0,b=1,c=0;
for(int i=0;i<=n;i++)
{
if(i==n)
printf("Fib(%d) = %lld\n",n,a);
c=a+b;
a=b;
b=c;
}
}
}
#include<iostream>
using namespace std;
int main()
{
int n,a,b=9999,x;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>x;
if(x<b)a=i,b=x;
}
printf("Minimum value: %d\nPosition: %d",b,a);
}
#include<iostream>
using namespace std;
int main()
{
int n;
char c;
cin>>n>>c;
double s=0,a;
for(int i=0;i<12;i++)
for(int j=0;j<12;j++)
{
cin>>a;
if(i==n)s+=a;
}
printf("%.1f",c=='S'?s:s/12);
}
#include<iostream>
using namespace std;
int main()
{
int n;
char c;
cin>>n>>c;
double s=0,a;
for(int i=0;i<12;i++)
for(int j=0;j<12;j++)
{
cin>>a;
if(j==n)s+=a;
}
printf("%.1f",c=='S'?s:s/12);
}
#include<iostream>
using namespace std;
int main()
{
char c;
cin>>c;
double s=0,a;
for(int i=0;i<12;i++)
for(int j=0;j<12;j++)
{
cin>>a;
if(j>i)s+=a;
}
printf("%.1f",c=='S'?s:s/66);
}
#include<iostream>
using namespace std;
int main()
{
char c;
cin>>c;
double s=0,a;
for(int i=0;i<12;i++)
for(int j=0;j<12;j++)
{
cin>>a;
if(j<i)s+=a;
}
printf("%.1f",c=='S'?s:s/66);
}
#include<iostream>
using namespace std;
int main()
{
char c;
cin>>c;
double s=0,a;
for(int i=0;i<12;i++)
for(int j=0;j<12;j++)
{
cin>>a;
if(i+j<11)s+=a;
}
printf("%.1f",c=='S'?s:s/66);
}
#include<iostream>
using namespace std;
int main()
{
char c;
cin>>c;
double s=0,a;
for(int i=0;i<12;i++)
for(int j=0;j<12;j++)
{
cin>>a;
if(i+j>11)s+=a;
}
printf("%.1f",c=='S'?s:s/66);
}
#include<iostream>
using namespace std;
int main()
{
char c;
cin>>c;
double s=0,a;
for(int i=0;i<12;i++)
for(int j=0;j<12;j++)
{
cin>>a;
if(j>i&&i+j<11)s+=a;
}
printf("%.1f",c=='S'?s:s/30);
}
#include<iostream>
using namespace std;
int main()
{
char c;
cin>>c;
double s=0,a;
for(int i=0;i<12;i++)
for(int j=0;j<12;j++)
{
cin>>a;
if(j>i&&i+j<11)s+=a;
}
printf("%.1f",c=='S'?s:s/30);
}
#include<iostream>
using namespace std;
int main()
{
char c;
cin>>c;
double s=0,a;
for(int i=0;i<12;i++)
for(int j=0;j<12;j++)
{
cin>>a;
if(j<i&&i+j<11)s+=a;
}
printf("%.1f",c=='S'?s:s/30);
}
#include<iostream>
using namespace std;
int main()
{
char c;
cin>>c;
double s=0,a;
for(int i=0;i<12;i++)
for(int j=0;j<12;j++)
{
cin>>a;
if(j>i&&i+j>11)s+=a;
}
printf("%.1f",c=='S'?s:s/30);
}
#include<iostream>
using namespace std;
int main()
{
int n,x;
while(cin>>n,n)
{
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
x=min(min(min(n-i+1,n-j+1),i),j);
cout<<x<<" ";
}
puts("");
}
puts("");
}
}
#include<iostream>
using namespace std;
int main()
{
int n,x;
while(cin>>n,n)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
x=abs(i-j)+1;
cout<<x<<' ';
}
puts("");
}
puts("");
}
}
#include<iostream>
using namespace std;
int main()
{
int n;
while(cin>>n,n)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
printf("%d ",1<<(i+j));
puts("");
}
puts("");
}
return 0;
}
#include <iostream>
#include<iostream>
using namespace std;
int main()
{
int f[111][111];
int n,m;
cin>>n>>m;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int x=1,y=1,d=0;
for(int i=1;i<=n*m;i++)
{
if(x+dx[d]>n||y+dy[d]>m||y+dy[d]==0||f[x+dx[d]][y+dy[d]])
d=(d+1)%4;
f[x][y]=i;
x+=dx[d];
y+=dy[d];
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
cout<<f[i][j]<<" ";
cout<<endl;
}
}
#include<iostream>
using namespace std;
int main()
{
string a;
getline(cin,a);
cout<<a.size();
}
#include<iostream>
using namespace std;
int main()
{
string a;
int sum=0;
getline(cin,a);
for(int i=0;i<a.size();i++)
{
if(a[i]>='0'&&a[i]<='9')
sum++;
}
cout<<sum;
}
#include<iostream>
using namespace std;
int main()
{
double d,sum=0;
cin>>d;
string a,b;
cin>>a>>b;
for(int i=0;i<a.size();i++)
if(a[i]==b[i])
sum++;
if(sum/a.size()>=d) cout<<"yes";
else cout<<"no";
}
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
while(n--)
{
string a,b;
cin>>a>>b;
if(a[0]==b[0]) cout<<"Tie";
else if(a[0]=='H'&&b[0]=='G'||a[0]=='G'&&b[0]=='B'||a[0]=='B'&&b[0]=='H') cout<<"Player1";
else cout<<"Player2";
cout<<endl;
}
}
#include<iostream>
using namespace std;
int main()
{
string s;
getline(cin,s);
for(int i=0;i<s.size();i++)
{
cout<<(char)(s[i]+s[(i+1)%s.size()]);
}
}
#include<iostream>
using namespace std;
int main()
{
char c;
while((c=getchar())!=-1)cout<<c<<' ';
}
#include<iostream>
using namespace std;
int main()
{
string s;
while(cin>>s)
cout<<s<<" ";
}
#include<iostream>
using namespace std;
int main()
{
string s;
getline(cin,s);
for(auto a:s)
{
if(a>='a'&&a<'z'||a>='A' && a<'Z')
cout<<char(a+1);
else if(a=='z') cout<<'a';
else if(a=='Z') cout<<"A";
else cout<<a;
}
}
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
string a,b;
getline(cin,a);
getline(cin,b);
transform(a.begin(),a.end(),a.begin(),::tolower);
transform(b.begin(),b.end(),b.begin(),::tolower);
if(a>b) puts(">");
else if(a==b) puts("=");
else puts("<");
}
#include <iostream>
using namespace std;
int main()
{
string s;
cin>>s;
char c;
cin>>c;
for(auto a:s)
{
if(a == c)cout<<"#";
else cout<<a;
}
}
#include<iostream>
#include<sstream>
using namespace std;
int main()
{
string s,a,b;
getline(cin,s);
stringstream c=stringstream(s);
cin>>a>>b;
while(c>>s)
{
if(s==a) cout<<b<<" ";
else cout<<s<<" ";
}
}
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
while(n--)
{
int maxn=-1;
string a,maxs;
cin>>a;
for(int i=0;i<a.size();i++)
{
int j=i;
int bj=0;
while(a[j]==a[i]&&j<a.size())
j++,bj++;
if(bj>maxn)
maxn=bj,maxs=a[i];
i=j-1;
}
cout<<maxs<<" "<<maxn<<endl;
}
}
#include<iostream>
#include<map>
using namespace std;
map<char,int> a;
int main()
{
string s;
cin>>s;
for(auto i:s)
a[i]++;
for(auto i:s)
{
if(a[i]==1)
{
cout<<i;
return 0;
}
}
cout<<"no";
}
#include <iostream>
using namespace std;
int main()
{
string s,c;
while(cin>>s>>c)
{
int bj=0;
for(int i=0;i<s.size();i++)
if(s[i]>s[bj])
bj=i;
s.insert(bj+1,c);
cout<<s<<endl;
}
}
#include <iostream>
using namespace std;
int main()
{
string s,t;
int v;
while(cin >>t)
{
if(t.find('.')!=-1) t.erase(t.find('.'));
if(t.size() >v)
{
v=t.size();
s=t;
}
}
cout<<s;
}
#include<iostream>
using namespace std;
int main()
{
string s[111];
int i=1;
while(cin>>s[i]) i++;
for(int j=i-1;j>=1;j--)
cout<<s[j]<<" ";
}
#include<iostream>
using namespace std;
int main()
{
string a,b;
cin>>a>>b;
string s1=a+a,s2=b+b;
if((s1.find(b)!=string::npos)||(s2.find(a)!=string::npos)){
cout<<"true";
}
else cout<<"false";
return 0;
}
#include<iostream>
using namespace std;
int main()
{
string s;
while(cin>>s,s!=".")
{
for(int i=s.size();i;i--)
{
if(s.size()%i==0)
{
string str,a;
int m=s.size()/i;
str+=s.substr(0,m);
for(int j=0;j<i;j++)
a+=str;
if(a==s)
{
cout<< i <<endl;
break;
}
}
}
}
return 0;
}
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
string s1,s2,s3;
char c;
while(cin>>c,c!=',')s1+=c;
while(cin>>c,c!=',')s2+=c;
while(cin>>c)s3+=c;
int t=s1.find(s2);
if(t==-1)puts("-1");
else
{
int r=-1;
for(int i=t+s2.size();i+s3.size()<=s1.size();i++)
if(s1.substr(i,s3.size())==s3)
r=i;
if(r==-1)puts("-1");
else printf("%d\n",r-(t+s2.size()));
}
}
#include <iostream>
#include <string>
using namespace std;
int main()
{
int n;
while(cin>>n,n)
{
string r[300];
/////////
for(int i=1;i<=n;i++)
{
cin>>r[i];
}
string s=r[1];
for(int i=1;i<=n;i++)
{
if(r[i].size()<s.size())
{
s=r[i];
}
}
///////找到最小的字符串
int bj=0;
for (int i=s.size();i>=1;i--)
{
int k=1;
for(int j=1;j<=n;j++)
{
if(r[j].substr(r[j].size()-i,i)!=s.substr(s.size()-i,i))
{
k=0;
break;
}
}
if(k)
{
bj=1;
cout<<s.substr(s.size()-i,i)<<endl;
break;
}
}
if(!bj)
cout<<endl;
}
return 0;
}
太nono了
什么意思???😯
hhhhhh
~~棒
~~~谢谢