#include <stdio.h>
#include <math.h>
int main(void) {
int a, b,c;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
printf("%d",(int)pow(a,b)%c);
return 0;
}
Telegram- https://t.me/Coding_solution_0
#include <math.h>
int main(void) {
int a, b,c;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
printf("%d",(int)pow(a,b)%c);
return 0;
}
Telegram- https://t.me/Coding_solution_0
#include<iostream>
using namespace std;
int main()
{
int n,i;
cin>>n;
int arr[n];
for(i=0;i<n;i++)
{
cin>>arr[i];
}
int len = n-1, curr = -1, next = 0, ans = 0;
for (int i = 0; next < len; i++)
{
if (i > curr)
{ ans++, curr = next;
next = max(next, arr[i] + i);
}
}
cout<<ans;
}
C++
Bicycle Racing
π Telegram:- https://t.me/Coding_solution_0
using namespace std;
int main()
{
int n,i;
cin>>n;
int arr[n];
for(i=0;i<n;i++)
{
cin>>arr[i];
}
int len = n-1, curr = -1, next = 0, ans = 0;
for (int i = 0; next < len; i++)
{
if (i > curr)
{ ans++, curr = next;
next = max(next, arr[i] + i);
}
}
cout<<ans;
}
C++
Bicycle Racing
π Telegram:- https://t.me/Coding_solution_0
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n,m,count = 0;
int rangenumber, c = 0, num, i, letest = 0;
cin>>num>>rangenumber;
while (c != rangenumber)
{
count = 0;
for (i = 2; i <= sqrt(num); i++)
{
if (num % i == 0)
{
count++;
break;
}
}
if (count == 0)
{
c++;
letest = num;
}
num = num + 1;
}
cout<<letest;
return 0;
}
π Telegram:https://t.me/Coding_solution_0
#include<cmath>
using namespace std;
int main()
{
int n,m,count = 0;
int rangenumber, c = 0, num, i, letest = 0;
cin>>num>>rangenumber;
while (c != rangenumber)
{
count = 0;
for (i = 2; i <= sqrt(num); i++)
{
if (num % i == 0)
{
count++;
break;
}
}
if (count == 0)
{
c++;
letest = num;
}
num = num + 1;
}
cout<<letest;
return 0;
}
π Telegram:https://t.me/Coding_solution_0
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d,s;
cin>>a>>b>>c>>d>>s;
int aa[4];
int a1=s/2000;
if(a1>=a)
{
aa[0]=a;
//cout<<a<<" ";
s-=(a*2000);
}
else
{
aa[0]=a;
//cout<<a1<<" ";
s-=(a1*2000);
}
int b1=s/500;
if(b1>=b)
{
aa[1]=b;
//cout<<b<<" ";
s-=(b*2000);
}
else
{
aa[1]=b1;
//cout<<b1<<" ";
s-=(b1*2000);
}
int c1=s/100;
if(c1>=c)
{
aa[2]=c;
//cout<<c<<" ";
s-=(c*2000);
}
else
{
aa[2]=c1;
//cout<<c1<<" ";
s-=(c1*2000);
}
int d1=s/20;
if(d1>=d)
{
aa[3]=d;
//cout<<d<<" ";
s-=(d*2000);
}
else
{
aa[3]=d1;
// cout<<d1<<" ";
s-=(d1*2000);
}
if(s!=0)
cout<<0;
else
cout<<aa[0]<<" "<<aa[1]<<" "<<aa[2]<<" "<<aa[3];
}
ATM MACHINE MINE CODE
π Telegram:https://t.me/Coding_solution_0
using namespace std;
int main()
{
int a,b,c,d,s;
cin>>a>>b>>c>>d>>s;
int aa[4];
int a1=s/2000;
if(a1>=a)
{
aa[0]=a;
//cout<<a<<" ";
s-=(a*2000);
}
else
{
aa[0]=a;
//cout<<a1<<" ";
s-=(a1*2000);
}
int b1=s/500;
if(b1>=b)
{
aa[1]=b;
//cout<<b<<" ";
s-=(b*2000);
}
else
{
aa[1]=b1;
//cout<<b1<<" ";
s-=(b1*2000);
}
int c1=s/100;
if(c1>=c)
{
aa[2]=c;
//cout<<c<<" ";
s-=(c*2000);
}
else
{
aa[2]=c1;
//cout<<c1<<" ";
s-=(c1*2000);
}
int d1=s/20;
if(d1>=d)
{
aa[3]=d;
//cout<<d<<" ";
s-=(d*2000);
}
else
{
aa[3]=d1;
// cout<<d1<<" ";
s-=(d1*2000);
}
if(s!=0)
cout<<0;
else
cout<<aa[0]<<" "<<aa[1]<<" "<<aa[2]<<" "<<aa[3];
}
ATM MACHINE MINE CODE
π Telegram:https://t.me/Coding_solution_0
#include <stdio.h>
int fact(int num){
if(num>1){
return num*fact(num-1);
}
else if(num<=1){
return 1;
} }
int main() {
int n,p,res;
scanf("%d",&n);
scanf("%d",&p);
res = fact(n)/(fact(p)*fact(n-p));
printf("%d",res);
return 0;
}
Pollution code
Telegram -
https://t.me/Coding_solution_0
int fact(int num){
if(num>1){
return num*fact(num-1);
}
else if(num<=1){
return 1;
} }
int main() {
int n,p,res;
scanf("%d",&n);
scanf("%d",&p);
res = fact(n)/(fact(p)*fact(n-p));
printf("%d",res);
return 0;
}
Pollution code
Telegram -
https://t.me/Coding_solution_0
#include <stdio.h>
int fact(int num){
if(num>1){
return num*fact(num-1);
}
else if(num<=1){
return 1;
} }
int main() {
int n,p,res;
scanf("%d",&n);
scanf("%d",&p);
res = fact(n)/(fact(p)*fact(n-p));
printf("%d",res);
return 0;
}
Pollution code
https://t.me/Coding_solution_0
int fact(int num){
if(num>1){
return num*fact(num-1);
}
else if(num<=1){
return 1;
} }
int main() {
int n,p,res;
scanf("%d",&n);
scanf("%d",&p);
res = fact(n)/(fact(p)*fact(n-p));
printf("%d",res);
return 0;
}
Pollution code
https://t.me/Coding_solution_0
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 998244353
#define add(x,y) ((x+y)%MOD)
#define mul(x,y) ((x*y)%MOD)
#define sub(x,y) ((MOD+x-y)%MOD)
ll fastpow(ll x, ll y){
ll temp = 1;
while(y){
if(y&1)
temp = mul(temp, x);
x = mul(x, x);
y>>=1;
}
return temp;
}
ll inv(ll x){
return fastpow(x,MOD-2);
}
ll frac[200100];
ll C(ll n, ll i){
return mul(frac[n], inv(mul(frac[i], frac[n-i])));
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,k;
cin>>n>>k;
if(k>=n){
cout<<0<<endl;
return 0;
}
ll ans = 0;
frac[0] = 1;
for(int i=1;i<=n;++i){
frac[i] = mul(i, frac[i-1]);
}
for(int i=0;i<=n-k;++i){
ll temp = mul(C(n-k,i), fastpow(n-k-i,n));
if(i&1)
ans = sub(ans, temp);
else
ans = add(ans,temp);
}
ans = mul(ans, C(n, n-k));
if(k)
ans = mul(ans, 2);
cout<<ans<<endl;
}
CHESS GAME CODE
Telegram - https://t.me/Coding_solution_0
using namespace std;
#define ll long long
#define MOD 998244353
#define add(x,y) ((x+y)%MOD)
#define mul(x,y) ((x*y)%MOD)
#define sub(x,y) ((MOD+x-y)%MOD)
ll fastpow(ll x, ll y){
ll temp = 1;
while(y){
if(y&1)
temp = mul(temp, x);
x = mul(x, x);
y>>=1;
}
return temp;
}
ll inv(ll x){
return fastpow(x,MOD-2);
}
ll frac[200100];
ll C(ll n, ll i){
return mul(frac[n], inv(mul(frac[i], frac[n-i])));
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,k;
cin>>n>>k;
if(k>=n){
cout<<0<<endl;
return 0;
}
ll ans = 0;
frac[0] = 1;
for(int i=1;i<=n;++i){
frac[i] = mul(i, frac[i-1]);
}
for(int i=0;i<=n-k;++i){
ll temp = mul(C(n-k,i), fastpow(n-k-i,n));
if(i&1)
ans = sub(ans, temp);
else
ans = add(ans,temp);
}
ans = mul(ans, C(n, n-k));
if(k)
ans = mul(ans, 2);
cout<<ans<<endl;
}
CHESS GAME CODE
Telegram - https://t.me/Coding_solution_0
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int t,count=0;
scanf("%d",&t);
for(int a0 = 0; a0 < t; a0++){
count=0;
int n;
int k;
scanf("%d %d",&n,&k);
int a[n];
for(int a_i = 0; a_i < n; a_i++){
scanf("%d",&a[a_i]);
}
for(int a_i = 0; a_i < n; a_i++){
if(a[a_i]<=0)
count++;
}
if(count<k)
printf("YES\n");
else
printf("NO\n");
//count=0;
}
return 0;
}
C language
Angry professor
Telegram- https://t.me/Coding_solution_0
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int t,count=0;
scanf("%d",&t);
for(int a0 = 0; a0 < t; a0++){
count=0;
int n;
int k;
scanf("%d %d",&n,&k);
int a[n];
for(int a_i = 0; a_i < n; a_i++){
scanf("%d",&a[a_i]);
}
for(int a_i = 0; a_i < n; a_i++){
if(a[a_i]<=0)
count++;
}
if(count<k)
printf("YES\n");
else
printf("NO\n");
//count=0;
}
return 0;
}
C language
Angry professor
Telegram- https://t.me/Coding_solution_0
// C++ program to find minimum time
// required to produce m items.
#include<bits/stdc++.h>
using namespace std;
// Return the minimum time required to
// produce m items with given machines.
int minTime(int arr[], int n, int m)
{
// Initialize time, items equal to 0.
int t = 0;
while (1)
{
int items = 0;
// Calculating items at each second
for (int i = 0; i < n; i++)
items += (t / arr[i]);
// If items equal to m return time.
if (items >= m)
return t;
t++; // Increment time
}
}
// Driver Code
int main()
{
int arr[] = { 1, 2, 3 };
int n = sizeof(arr)/sizeof(arr[0]);
int m = 11;
cout << minTime(arr, n, m) << endl;
return 0;
}
Minimum time
C language
Telegram-
https://t.me/Coding_solution_0
// required to produce m items.
#include<bits/stdc++.h>
using namespace std;
// Return the minimum time required to
// produce m items with given machines.
int minTime(int arr[], int n, int m)
{
// Initialize time, items equal to 0.
int t = 0;
while (1)
{
int items = 0;
// Calculating items at each second
for (int i = 0; i < n; i++)
items += (t / arr[i]);
// If items equal to m return time.
if (items >= m)
return t;
t++; // Increment time
}
}
// Driver Code
int main()
{
int arr[] = { 1, 2, 3 };
int n = sizeof(arr)/sizeof(arr[0]);
int m = 11;
cout << minTime(arr, n, m) << endl;
return 0;
}
Minimum time
C language
Telegram-
https://t.me/Coding_solution_0
Angry professor
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int t,count=0;
scanf("%d",&t);
for(int a0 = 0; a0 < t; a0++){
count=0;
int n;
int k;
scanf("%d %d",&n,&k);
int a[n];
for(int a_i = 0; a_i < n; a_i++){
scanf("%d",&a[a_i]);
}
for(int a_i = 0; a_i < n; a_i++){
if(a[a_i]<=0)
count++;
}
if(count<k)
printf("YES\n");
else
printf("NO\n");
//count=0;
}
return 0;
}
C language
Telegram- https://t.me/Coding_solution_0
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int t,count=0;
scanf("%d",&t);
for(int a0 = 0; a0 < t; a0++){
count=0;
int n;
int k;
scanf("%d %d",&n,&k);
int a[n];
for(int a_i = 0; a_i < n; a_i++){
scanf("%d",&a[a_i]);
}
for(int a_i = 0; a_i < n; a_i++){
if(a[a_i]<=0)
count++;
}
if(count<k)
printf("YES\n");
else
printf("NO\n");
//count=0;
}
return 0;
}
C language
Telegram- https://t.me/Coding_solution_0