Skip to content

Instantly share code, notes, and snippets.

@vipul43
Created July 21, 2020 20:46
Show Gist options
  • Save vipul43/c869c0f078c9c7e0c61a8838d3db76f5 to your computer and use it in GitHub Desktop.
Save vipul43/c869c0f078c9c7e0c61a8838d3db76f5 to your computer and use it in GitHub Desktop.
ladderid_11 question
// #include<bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <numeric>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i=a; i<(b); ++i)
void readIntArray(int arr[], int n);
void readIntVec(vector<int> &v, int n);
const char nl = '\n';
void solution(){
//write your code here
int a, b, c;
cin >> a >> b >> c;
bool flag = false;
int sum = 0;
FOR(x, 1, (int) pow(10, 4)+1){
FOR(y, 1, (int) pow(10, 4)+1){
if(a==x*y){
int z = b/y;
if(c==z*x){
flag = true;
sum+=(4*(x+y+z));
break;
}
}
}
if(flag){
break;
}
}
cout << sum << nl;
}
int main() {
//fast i/o
ios_base::sync_with_stdio(false);cin.tie(NULL);
int T=1;
// cin >> T;
while(T--){
solution();
}
return 0;
}
/*
ASCII OF NUMBERS 0-9 ==> [48, 57]
ASCII OF UPPERCASE ALPHABETS A-Z ==> [65, 90]
ASCII OF LOWERCASE ALPHABETS a-z ==> [97, 122]
ASCII OF WHITESPACE ==> [32]
ASCII OF SPECIAL CHARACTERS I ==> [33, 47]
ASCII OF SPECIAL CHARACTERS II ==> [58, 64]
ASCII OF SPECIAL CHARACTERS III ==> [91, 96]
ASCII OF SPECIAL CHARACTERS IV ==> [123, 126]
SPECIAL CHARATERS I ==> [!,",#,$,%,&,',(,),*,+...,/]
*/
void readIntArray(int arr[], int n){
FOR(i, 0, n){
cin >> arr[i];
}
}
void readIntVec(vector<int> &v, int n){
FOR(i, 0, n){
int x;
cin >> x;
v.push_back(x);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment