# Codechef Practice | Week 1

## CODECHEF SOLUTION

Week 1: Codechef Practice

# 1. Total Prize Money: PRIZEPOOL

``````#include <iostream>
using namespace std;

int main() {
int txP;
cin>>txP;
for(int index=0;index<txP;index++)
{
int xx,yx;
cin>>xx>>yx;
cout<<10*xx+90*yx<<endl;
}
return 0;

}``````

## 2. My very 1st contest: MY1STCONTEST

``````#include <iostream>
using namespace std;

int main() {
int n,a,b;
cin>>n>>a>>b;
int p=n-a;
int k=p-b;

cout<<p<<" ";
cout<<k<<endl;
return 0;
}``````

## 3. Mutated Minions: CHN15A

CHN15A

``````#include <bits/stdc++.h>
using namespace std;

#define fin(a, b) for(ll i = a; i < b; i++)
#define fdec(a, b) for(ll i = a; i > b; i--)
#define ll long long
#define vl vector<ll>
#define pb push_back
#define FAST ios::sync_with_stdio(false); cin.tie(0)
const long long M = 1e9 + 7;

signed main()
{
FAST;
ll t;
cin >> t;
while (t--) {
ll n, k;
cin >> n >> k;
vector<ll> v(n);
for (auto &i: v) cin >> i;
ll c = 0;
for (ll i = 0; i < n; i++) {
v[i] += k;
if (v[i] % 7 == 0) ++c;
}
cout << c << '\n';
}
return 0;
}``````

## 4. Primality Test Problem: PRB01

``````#include <iostream>
using namespace std;
#define endl '\n'

int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

int n,t,i,y;
cin>>t;
while(t--)
{
cin>>n;
if(n==1)
cout<<"no"<<endl;
else{
y=0;
for(i=2; i*i<=n; i++)
{
if(n%i==0)
{
y=1;
break;
}
}
if(y==0)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}

}
return 0;

}``````

## 5. Degree of Polynomial: DPOLY

``````#include <iostream>
using namespace std;
int main()
{
int a,t;
cin>>t;
for(a=0;a<t;a++)
{
int n,a[1000],i;
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=n-1;i>=0;i--)
{
if(a[i]!=0)
{
break;
}
}
cout<<i<<endl;

}
return 0;
}``````