This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void solveA(){ | |
string s; cin>>s; | |
int a[3] = {}; | |
f(i,0,sz(s)){ | |
if(s[i]=='A') a[0]++; | |
else if(s[i]=='B') a[1]++; | |
else a[2]++; | |
} | |
bool ok = a[1] == (a[0]+a[2]); | |
if(ok) cout<<"YES\n"; else cout<<"NO\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fuck this man !! | |
#include<bits/stdc++.h> | |
#include <iostream> | |
#include <vector> | |
#include <iterator> | |
using namespace std; | |
#define int long long | |
#define ld long double | |
#define pb push_back |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i)) | |
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i)) | |
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i)) | |
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i)) | |
#define ALL(x) std::begin(x), std::end(x) | |
using namespace std; | |
class xor_shift_128 { | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import cv2 | |
target = 'enrollment_num' | |
src = 'pictures' | |
newSize = (1024, 1024) | |
if os.path.isdir(target): | |
os.system('rm -r ' + target) | |
os.mkdir(target) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- first question : | |
conider the criteria of minimum surface area, for that all the cubes must be placed adjacent with side. | |
with number of faces visible, allot the maximum possible number to them | |
void solve(){ | |
int n; cin>>n; | |
int four=n/4; | |
int rem=n%4; | |
int ans=four*44; | |
if(four!=0){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// divide by 2 the maximum element of array, what is the minimum maximum element you can get at end. | |
// question link : https://www.hackerearth.com/problem/algorithm/beautiful-division/ | |
void solve(){ | |
int n,k; cin>>n>>k; | |
bool all_zero=0; | |
mpi mp; f(i,0,n){ | |
int x; cin>>x; ++mp[x]; | |
if(x!=0) all_zero=1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
bool isValidSudoku(vector<vector<char>>& board) { | |
map<char,int> mp; | |
for(char i='1';i<='9';++i) mp[i]=i-'0'; | |
map<int,char> mp1; | |
for(int i=1;i<=9;++i) mp1[i]=i+'0'; | |
for(int i=0;i<9;++i){ | |
bool valid=1; | |
int fre[9]={0}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
vector<vector<int>> permute(vector<int>& nums) { | |
vector<vector<int>> ret; | |
sort(nums.begin(),nums.end()); | |
do{ | |
ret.push_back(nums); | |
}while(next_permutation(nums.begin(),nums.end())); | |
return ret; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
void nextPermutation(vector<int>& nums) { | |
bool xp=next_permutation(nums.begin(),nums.end()); | |
if(!xp) sort(nums.begin(),nums.end()); | |
return ; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
vector<string> ret; | |
string s; | |
void rec(int a,int b){ | |
if(a<0 || b<0 || a>b) return ; | |
if(a==0 && b==0) { | |
ret.push_back(s); | |
return ; | |
} |
NewerOlder