From c8ca25dd4b3a54dd05decf1b822fa94ef3c5de3d Mon Sep 17 00:00:00 2001 From: Biswajit Rout Date: Sun, 6 Sep 2020 14:09:18 +0530 Subject: [PATCH] Add files via upload --- 110A - nearly_lucky_no.cpp | 20 +++++++++++++ 112A - Petya_and_strings.cpp | 30 ++++++++++++++++++++ 116A - tram.cpp | 15 ++++++++++ 133A - hq9+.cpp | 20 +++++++++++++ 141A - Amusing_joke.cpp | 17 +++++++++++ 144A - arrival_of_the_general.cpp | 33 ++++++++++++++++++++++ 148A - insomnia_cure.cpp | 27 ++++++++++++++++++ 151A - Soft_Drinking.cpp | 20 +++++++++++++ 155A - I_love_username.cpp | 22 +++++++++++++++ 200B - drinks.cpp | 14 +++++++++ 228A - horseshoe.cpp | 19 +++++++++++++ 231A - team.cpp | 15 ++++++++++ 233A-perfect_permutation.cpp | 14 +++++++++ 236A - boyorgirl.cpp | 22 +++++++++++++++ 246a - cupboards.cpp | 35 +++++++++++++++++++++++ 263A - beautiful_matrix.cpp | 25 ++++++++++++++++ 266A - stones_on_table.cpp | 21 ++++++++++++++ 266B - queue_at_school.cpp | 18 ++++++++++++ 271A - beautiful_year.cpp | 17 +++++++++++ 281A - word_capitalization.cpp | 18 ++++++++++++ 282A - bit++.cpp | 18 ++++++++++++ 32B - borze.cpp | 25 ++++++++++++++++ 339A - helpful_maths.cpp | 47 +++++++++++++++++++++++++++++++ 59A - word.cpp | 32 +++++++++++++++++++++ 61A - ultra_fast.cpp | 15 ++++++++++ 69A - young_physicist.cpp | 29 +++++++++++++++++++ 71A - way_too_long_words.cpp | 29 +++++++++++++++++++ 80A-panoramix.cpp | 34 ++++++++++++++++++++++ 28 files changed, 651 insertions(+) create mode 100644 110A - nearly_lucky_no.cpp create mode 100644 112A - Petya_and_strings.cpp create mode 100644 116A - tram.cpp create mode 100644 133A - hq9+.cpp create mode 100644 141A - Amusing_joke.cpp create mode 100644 144A - arrival_of_the_general.cpp create mode 100644 148A - insomnia_cure.cpp create mode 100644 151A - Soft_Drinking.cpp create mode 100644 155A - I_love_username.cpp create mode 100644 200B - drinks.cpp create mode 100644 228A - horseshoe.cpp create mode 100644 231A - team.cpp create mode 100644 233A-perfect_permutation.cpp create mode 100644 236A - boyorgirl.cpp create mode 100644 246a - cupboards.cpp create mode 100644 263A - beautiful_matrix.cpp create mode 100644 266A - stones_on_table.cpp create mode 100644 266B - queue_at_school.cpp create mode 100644 271A - beautiful_year.cpp create mode 100644 281A - word_capitalization.cpp create mode 100644 282A - bit++.cpp create mode 100644 32B - borze.cpp create mode 100644 339A - helpful_maths.cpp create mode 100644 59A - word.cpp create mode 100644 61A - ultra_fast.cpp create mode 100644 69A - young_physicist.cpp create mode 100644 71A - way_too_long_words.cpp create mode 100644 80A-panoramix.cpp diff --git a/110A - nearly_lucky_no.cpp b/110A - nearly_lucky_no.cpp new file mode 100644 index 0000000..bd16007 --- /dev/null +++ b/110A - nearly_lucky_no.cpp @@ -0,0 +1,20 @@ +#include +using namespace std; +int main(){ + long long y; + int a=0; + cin >> y; + while(y!=0){ + if(y%10==4 || y%10==7){ + a++; + } + y = y/10; + } + if(a==4 || a==7){ + cout<<"YES"< +#include +#include +using namespace std; +int main(){ + int count = 0; + string s,s1; + cin>>s>>s1; + int l = s.length(); + for(int i=0;i +using namespace std; +int main(){ + int n,a,b,c=0,max=0; + cin>>n; + for(int i=0;i>a>>b; + c=c+(b-a); + if(c>max){ + max=c; + } + } + cout< +#include +using namespace std; +int main(){ + int count=0; + string s; + cin>>s; + int l = s.length(); + for(int i=0;i +#include +#include +using namespace std; +int main(){ + string s1,s2,s3; + cin>>s1>>s2>>s3; + s1.append(s2); + sort(s1.begin(),s1.end()); + sort(s3.begin(),s3.end()); + if(s1==s3){ + cout<<"YES"; + } + else { + cout<<"NO"; + } +} \ No newline at end of file diff --git a/144A - arrival_of_the_general.cpp b/144A - arrival_of_the_general.cpp new file mode 100644 index 0000000..bcd2100 --- /dev/null +++ b/144A - arrival_of_the_general.cpp @@ -0,0 +1,33 @@ +#include +#include +using namespace std; + +int main() { +int n; +int maxvalue=0; +int minvalue=1000; +int maxindex=0; +int minindex=0; +cin>>n; +for(int i=0;i>x; +if(x>maxvalue){ + maxindex=i; + maxvalue=x; +} + if(x<=minvalue){ + minindex=i; + minvalue=x; + } +} +if(maxindex>minindex){ + cout<<(maxindex+(n-1)-minindex)-1; +} +else{ + cout<<(maxindex+(n-1)-minindex); + +} + + return 0; +} \ No newline at end of file diff --git a/148A - insomnia_cure.cpp b/148A - insomnia_cure.cpp new file mode 100644 index 0000000..59e996f --- /dev/null +++ b/148A - insomnia_cure.cpp @@ -0,0 +1,27 @@ +#include +#include +using namespace std; + +int main() +{ + int k, l, m, n, d; + int cont = 0; + + cin >> k >> l >> m >> n >> d; + cont = d; + + if(k == 1 || l == 1 || m == 1 || n == 1) + { + cout << d << endl; + } + else + { + for(int i = 1; i <= d; i++) + { + if((i%k != 0) && (i%l != 0) && (i%m != 0) && (i%n != 0)) + cont--; + } + cout << cont << endl; + } + return 0; +} \ No newline at end of file diff --git a/151A - Soft_Drinking.cpp b/151A - Soft_Drinking.cpp new file mode 100644 index 0000000..d7898b1 --- /dev/null +++ b/151A - Soft_Drinking.cpp @@ -0,0 +1,20 @@ +#include +using namespace std; +int main(){ + int n, k, l, c, d, p, nl, np,min; + cin>> n>>k>>l>>c>>d>>p>>nl>>np; + int r = (k*l)/nl; + int b = c*d; + int q = p/np; + if(r +using namespace std; +int main() { + int A[1001],n,min,max,count=0; + cin>>n; + for(int i=0;i>A[i]; + } + min=A[0]; + max=A[0]; + for(int i=1;imax){ + count++; + max=A[i]; + } + else if(A[i] +using namespace std; +int main(){ + int n; + float volume=0.0; + cin >> n; + for(int i=0;i> x; + volume +=x; + } + float c= volume/n; + cout< +using namespace std; +int main(){ + int A[4],count=0,a=0; + for(int i=0;i<4;i++){ + cin>>A[i]; + } + for(int i=0;i<4;i++){ + if(a!=A[i]){ + for(int j=i+1;j<4;j++){ + if(A[i]==A[j]){ + count++; + a=A[i]; + } + } + } + } + cout< +using namespace std; +int main(){ + int a,b,c,sum=0,count=0,n; + cin>>n; + for(int i=0;i>a>>b>>c; + sum=sum+a+b+c; + if(sum>=2){ + count++; + } + sum=0; + } + cout< +using namespace std; +int main(){ + int n; + cin >> n; + if(n%2==1){ + cout<<-1; + } + else { + for(int i=1;i<=n;i+=2){ + cout< +#include +#include +using namespace std; +int main(){ + int count=0; + string s; + cin>>s; + int l=s.length(); + sort(s.begin(),s.end()); + for(int i=0;i +using namespace std; +int main() { + int n,l,r; + int lopen=0,lclose=0,ropen=0,rclose=0; + cin>>n; + for(int i=0;i>l>>r; + if(l==0){ + lclose++; + } + else{ + lopen++; + } + if(r==0){ + rclose++; + } + else{ + ropen++; + } + } + if(lclose +#include + +using namespace std; + +int main() +{ + int x,y,i,j,a[6][6],ans; + for(i=0;i<5;i++){ + for(j=0;j<5;j++){ + scanf("%d",&a[i][j]); + } + } + for(i=0;i<5;i++){ + for(j=0;j<5;j++){ + if(a[i][j]==1){ + x=i+1; + y=j+1; + } + } + } + ans=abs(x-3)+abs(y-3); + printf("%d\n",ans); + return 0; +} \ No newline at end of file diff --git a/266A - stones_on_table.cpp b/266A - stones_on_table.cpp new file mode 100644 index 0000000..481c861 --- /dev/null +++ b/266A - stones_on_table.cpp @@ -0,0 +1,21 @@ +#include +#include +using namespace std; +int main() { + int l; + string s; + int count=0; + cin >> l >> s; + for(int i=0;i +#include +using namespace std; +int main() { + int n,t; + string s; + cin >> n >> t >>s; + while(t--) { + for(int i=0;i +using namespace std; +int main(){ + int y; + cin>>y; + while(true){ + y += 1; + int a = y/1000; + int b = (y/100)%10; + int c = (y/10)%10; + int d = y%10; + if(a!=b && a!=c && a!=d && b!=c && b!=d && c!=d) { + break; + } + } + cout< +#include +using namespace std; +int main() { + string s; + cin >> s; + int l= s.length(); + for(int i=0;i +#include +using namespace std; +int main(){ + int n,x=0; + string s; + cin>>n; + for(int i=0;i>s; + if(s=="++X" || s=="X++"){ + x++; + } + else if(s=="--X" || s=="X--"){ + x--; + } + } + cout< +#include + +using namespace std; +int main() { + string s; + cin >> s; + int l = s.length(); + for(int i=0;i +#include +using namespace std; +int main(){ + string s; + int c1=0,c2=0,c3=0; + cin>>s; + for(int i=0;i +#include +using namespace std; +int main(){ + string s; + int upper=0,lower=0; + cin >> s; + int l = s.length(); + for(int i=0;i=upper){ + for(int i=0;i +#include +using namespace std; +int main(){ + string s1,s2; + cin>>s1>>s2; + for(int i=0;i + +using namespace std; + +int main() + { + int n, x, y, z, xsum=0, ysum=0, zsum=0; + cin >> n; + + while (n--) + { + cin >> x >> y >> z; + xsum += x; + ysum += y; + zsum += z; + } + + if (xsum == 0 && ysum == 0 && zsum == 0) + { + cout << "YES" << endl; + } + else + { + cout << "NO" << endl; + } + + return 0; +} diff --git a/71A - way_too_long_words.cpp b/71A - way_too_long_words.cpp new file mode 100644 index 0000000..d57a358 --- /dev/null +++ b/71A - way_too_long_words.cpp @@ -0,0 +1,29 @@ +#include +#include +using namespace std; +int main(){ + int n; + string s[100],s1[100]; + cin>>n; + for(int i=0;i>s[i]; + } + for(int i=0;i +using namespace std; +int a, b, h = 0; +int mas[16] = { + 2, + 3, + 5, + 7, + 11, + 13, + 17, + 19, + 23, + 29, + 31, + 37, + 41, + 43, + 47 +}; +int main() { + cin >> a >> b; + for (int i = 0; i < 15; i++) { + if (a == mas[i] && b == mas[i + 1]) { + h++; + break; + } + } + if (h == 0) { + cout << "NO"; + } else { + cout << "YES"; + } +} \ No newline at end of file