Skip to content

Commit cee1558

Browse files
committed
cf round and practice on atcoder
1 parent 6f5e501 commit cee1558

16 files changed

+1687
-0
lines changed

Atcoder/practice/a.out

50.3 KB
Binary file not shown.

Atcoder/practice/abc186_a-Brick.cpp

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
written by Pankaj Kumar.
3+
country:-INDIA
4+
*/
5+
#include <bits/stdc++.h>
6+
#include <ext/pb_ds/assoc_container.hpp>
7+
#include <ext/pb_ds/tree_policy.hpp>
8+
using namespace std;
9+
using namespace __gnu_pbds;
10+
typedef long long ll ;
11+
typedef vector<ll> vl;
12+
#define speed cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
13+
// define values.
14+
// #define mod 1000000007
15+
#define phi 1.618
16+
/* Abbrevations */
17+
#define ff first
18+
#define ss second
19+
#define mp make_pair
20+
#define line cout<<endl;
21+
#define pb push_back
22+
#define Endl "\n"
23+
// loops
24+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
25+
// Some print
26+
#define no cout<<"NO"<<endl;
27+
#define yes cout<<"YES"<<endl;
28+
// sort
29+
#define all(V) (V).begin(),(V).end()
30+
#define srt(V) sort(all(V))
31+
#define srtGreat(V) sort(all(V),greater<ll>())
32+
#define printv(v) for(ll i=0;i<ll(v.size());i++){cout<<v[i]<<" ";} line;
33+
// some extra
34+
#define sz(V) ll(V.size())
35+
/* ONLINE JUDGE */
36+
// #ifdef ONLINE_JUDGE
37+
// freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
38+
// #endif
39+
// template
40+
template <typename T>
41+
T mymax(T x,T y)
42+
{
43+
return (x>y)?x:y;
44+
}
45+
// function
46+
47+
ll power(ll x,ll y,ll mod)
48+
{
49+
ll res=1;
50+
// x=x%mod;
51+
while(y>0)
52+
{
53+
if(y%2==1)
54+
{
55+
res*=x;
56+
// res=res%mod;
57+
}
58+
y/=2; x*=x; // x=x%mod;
59+
}
60+
return res;
61+
}
62+
ll str_to_num(string s)
63+
{
64+
return stoi(s);
65+
}
66+
67+
string num_to_str(ll num)
68+
{
69+
return to_string(num);
70+
}
71+
// datatype definination
72+
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
73+
74+
/* ascii value
75+
A=65,Z=90,a=97,z=122
76+
*/
77+
/* -----------------------------------------------------------------------------------*/
78+
79+
ll solve()
80+
{
81+
ll n,w;
82+
cin>>n>>w;
83+
cout<<n/w<<endl;
84+
return 0;
85+
}
86+
87+
int main()
88+
{
89+
speed;
90+
// freopen("input.txt","r",stdin);
91+
// freopen("output.txt","w",stdout);
92+
ll TestCase=1;
93+
// cin>>TestCase;
94+
while(TestCase--)
95+
{
96+
solve();
97+
}
98+
}
99+
100+
/* stuff you should look before submission
101+
* int overflow
102+
* special test case (n=0||n=1||n=2)
103+
* don't get stuck on one approach if you get wrong answer
104+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/*
2+
written by Pankaj Kumar.
3+
country:-INDIA
4+
*/
5+
#include <bits/stdc++.h>
6+
#include <ext/pb_ds/assoc_container.hpp>
7+
#include <ext/pb_ds/tree_policy.hpp>
8+
using namespace std;
9+
using namespace __gnu_pbds;
10+
typedef long long ll ;
11+
typedef vector<ll> vl;
12+
#define speed cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
13+
// define values.
14+
// #define mod 1000000007
15+
#define phi 1.618
16+
/* Abbrevations */
17+
#define ff first
18+
#define ss second
19+
#define mp make_pair
20+
#define line cout<<endl;
21+
#define pb push_back
22+
#define Endl "\n"
23+
// loops
24+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
25+
// Some print
26+
#define no cout<<"NO"<<endl;
27+
#define yes cout<<"YES"<<endl;
28+
// sort
29+
#define all(V) (V).begin(),(V).end()
30+
#define srt(V) sort(all(V))
31+
#define srtGreat(V) sort(all(V),greater<ll>())
32+
#define printv(v) for(ll i=0;i<ll(v.size());i++){cout<<v[i]<<" ";} line;
33+
// some extra
34+
#define sz(V) ll(V.size())
35+
/* ONLINE JUDGE */
36+
// #ifdef ONLINE_JUDGE
37+
// freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
38+
// #endif
39+
// template
40+
template <typename T>
41+
T mymax(T x,T y)
42+
{
43+
return (x>y)?x:y;
44+
}
45+
// function
46+
47+
ll power(ll x,ll y,ll mod)
48+
{
49+
ll res=1;
50+
// x=x%mod;
51+
while(y>0)
52+
{
53+
if(y%2==1)
54+
{
55+
res*=x;
56+
// res=res%mod;
57+
}
58+
y/=2; x*=x; // x=x%mod;
59+
}
60+
return res;
61+
}
62+
ll str_to_num(string s)
63+
{
64+
return stoi(s);
65+
}
66+
67+
string num_to_str(ll num)
68+
{
69+
return to_string(num);
70+
}
71+
// datatype definination
72+
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
73+
74+
/* ascii value
75+
A=65,Z=90,a=97,z=122
76+
*/
77+
/* -----------------------------------------------------------------------------------*/
78+
79+
ll solve()
80+
{
81+
ll n,m;
82+
cin>>n>>m;
83+
ll sum=0,mini=LONG_MAX;
84+
for(ll i=0;i<(n*m);i++)
85+
{
86+
ll temp;
87+
cin>>temp;
88+
sum+=temp;
89+
mini=min(mini,temp);
90+
}
91+
cout<<abs(sum-(mini*(n*m)))<<endl;
92+
return 0;
93+
}
94+
95+
int main()
96+
{
97+
speed;
98+
// freopen("input.txt","r",stdin);
99+
// freopen("output.txt","w",stdout);
100+
ll TestCase=1;
101+
// cin>>TestCase;
102+
while(TestCase--)
103+
{
104+
solve();
105+
}
106+
}
107+
108+
/* stuff you should look before submission
109+
* int overflow
110+
* special test case (n=0||n=1||n=2)
111+
* don't get stuck on one approach if you get wrong answer
112+
*/
+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/*
2+
written by Pankaj Kumar.
3+
country:-INDIA
4+
*/
5+
#include <bits/stdc++.h>
6+
#include <ext/pb_ds/assoc_container.hpp>
7+
#include <ext/pb_ds/tree_policy.hpp>
8+
using namespace std;
9+
using namespace __gnu_pbds;
10+
typedef long long ll ;
11+
typedef vector<ll> vl;
12+
#define speed cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
13+
// define values.
14+
// #define mod 1000000007
15+
#define phi 1.618
16+
/* Abbrevations */
17+
#define ff first
18+
#define ss second
19+
#define mp make_pair
20+
#define line cout<<endl;
21+
#define pb push_back
22+
#define Endl "\n"
23+
// loops
24+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
25+
// Some print
26+
#define no cout<<"NO"<<endl;
27+
#define yes cout<<"YES"<<endl;
28+
// sort
29+
#define all(V) (V).begin(),(V).end()
30+
#define srt(V) sort(all(V))
31+
#define srtGreat(V) sort(all(V),greater<ll>())
32+
#define printv(v) for(ll i=0;i<ll(v.size());i++){cout<<v[i]<<" ";} line;
33+
// some extra
34+
#define sz(V) ll(V.size())
35+
/* ONLINE JUDGE */
36+
// #ifdef ONLINE_JUDGE
37+
// freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
38+
// #endif
39+
// template
40+
template <typename T>
41+
T mymax(T x,T y)
42+
{
43+
return (x>y)?x:y;
44+
}
45+
// function
46+
47+
ll power(ll x,ll y,ll mod)
48+
{
49+
ll res=1;
50+
// x=x%mod;
51+
while(y>0)
52+
{
53+
if(y%2==1)
54+
{
55+
res*=x;
56+
// res=res%mod;
57+
}
58+
y/=2; x*=x; // x=x%mod;
59+
}
60+
return res;
61+
}
62+
ll str_to_num(string s)
63+
{
64+
return stoi(s);
65+
}
66+
67+
string num_to_str(ll num)
68+
{
69+
return to_string(num);
70+
}
71+
// datatype definination
72+
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
73+
74+
/* ascii value
75+
A=65,Z=90,a=97,z=122
76+
*/
77+
/* -----------------------------------------------------------------------------------*/
78+
79+
80+
ll solve()
81+
{
82+
ll n;
83+
cin>>n;
84+
ll ans=0;
85+
for(ll i=1;i<=n;i++)
86+
{
87+
string s=to_string(i);
88+
ll flag=0;
89+
for(auto x:s)
90+
{
91+
if(x=='7')
92+
{
93+
flag=1;
94+
break;
95+
}
96+
}
97+
if(flag==0)
98+
{
99+
ll temp=i;
100+
while(temp)
101+
{
102+
if((temp%8)==7)
103+
{
104+
flag=1;
105+
break;
106+
}
107+
temp/=8;
108+
}
109+
}
110+
if(flag==0)
111+
ans++;
112+
}
113+
cout<<ans<<endl;
114+
return 0;
115+
}
116+
117+
int main()
118+
{
119+
speed;
120+
// freopen("input.txt","r",stdin);
121+
// freopen("output.txt","w",stdout);
122+
ll TestCase=1;
123+
// cin>>TestCase;
124+
while(TestCase--)
125+
{
126+
solve();
127+
}
128+
}
129+
130+
/* stuff you should look before submission
131+
* int overflow
132+
* special test case (n=0||n=1||n=2)
133+
* don't get stuck on one approach if you get wrong answer
134+
*/

0 commit comments

Comments
 (0)