Professional Documents
Culture Documents
#include <bits/stdc++.h>
string n;
int res=0;
main(){
freopen("cau2.inp","r",stdin);
freopen("cau2.out","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int a=0;a<n.size();a++){
res+=n[a]-48;
reverse(n.begin(),n.end());
Bai 3.
#include <bits/stdc++.h>
if(n<2){
return false;
if(n==2||n==3){
return true;
}
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
return true;
int n,h[MAX],d=0,res=INT_MIN,res1=0,MAXn=0;
map<int,int>cnt;
main(){
freopen("cau3.inp","r",stdin);
freopen("cau3.out","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int a=0;a<n;a++){
if(check(h[a])==true){
d++;
if(h[a]<0){
res=max(res,h[a]);
cnt[h[a]]++;
if(cnt[h[a]]>res1){
res1=cnt[h[a]];
MAXn=h[a];
}
if(res==INT_MIN){
res=0;
cout << d << "\n" << res <<"\n"<< MAXn <<" "<<res1;
Cau 4.
#include <bits/stdc++.h>
string n;
map<int,int>cnt;
main(){
freopen("cau4.inp","r",stdin);
freopen("cau4.out","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
getline(cin,n);
for(int a=0;a<n.size();a++){
if(n[0]>=97){
n[0]=(char)n[0]-32;
while(n[0]==' '){
n.erase(a,1);
n.erase(a,1);
a--;
}
n[0]=(char)n[0]+32;
for(int a=0;a<n.size();a++){
cnt[n[a]]++;
for(int a=97;a<=122;a++){
if(cnt[(char)a]>0){
cout << (char)(a-32) << " " << cnt[(char)a] << "\n";
Cau 5.
#include <bits/stdc++.h>
const ll MAX=1e8+7;
int l,r,n;
ll h[MAX],res=0,v[MAX];
main(){
freopen("cau5.inp","r",stdin);
freopen("cau5.out","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
v[0]=h[0]=0;
l=1;
for(int a=1;a<=n;a++){
v[a]=v[a-1]+h[a];
if(v[a]>0){
res=v[a];
r=a;
for(int a=1;a<n;a++){
for(int i=a+1;i<=n;i++){
if(v[i]-v[a]>res){
res=v[i]-v[a];
l=a+1;
r=i;
Cau 6.
#include <bits/stdc++.h>
string n;
int k;
int val=0;
main()
freopen("cau6.inp","r",stdin);
freopen("cau6.out","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
for(int a=0;a<n.size();a++){
if(val>=k){
val=val%k;
if(n[a]-'0'<k){
val=val*10+n[a]-'0';