Posts

Showing posts from September, 2023

112. a^b-b^a - Codeforces || You are given natural numbers a and b. Find a^b-b^a. Codeforces

  112. a^b-b^a https://codeforces.com/problemsets/acmsguru/problem/99999/112 time limit per test: 0.25 sec. memory limit per test: 4096 KB You are given natural numbers a and b. Find a^b-b^a.  Input Input contains numbers a and b (1≤a,b≤100). Output Write answer to output. Sample Input 2 3 Sample Output -1 Solution Code: C++ #include <iostream> #include <cmath> // solved the problem but not accepted with this code... // i got accepted with the python code. int main () { int a, b; std::cin >> a >> b; long long pa = pow (a, b); long long pb = pow (b, a); std::cout << pa - pb << std::endl; return 0 ; } Solution Code: Python 3 # Accepted a,b = map ( int , input ().split()) pa = pow (a,b) pb = pow (b,a) print (pa - pb)

403. Scientific Problem - C++ / C - Solution - Codeforces ACMSGURU problemset

403. Scientific Problem Time limit per test: 0.25 second(s) Memory limit: 65536 kilobytes input: standard output: standard Once upon a time Professor Idioticideasinventor was travelling by train. Watching cheerless landscape outside the window, he decided to invent the theme of his new scientific work. All of a sudden a brilliant idea struck him: to develop an effective algorithm finding an integer number, which is x times less than the sum of all its integer positive predecessors, where number x is given. As far as he has no computer in the train, you have to solve this difficult problem. Input The first line of the input file contains an integer number x (1 ≤ x ≤ 109). OutputOutput an integer number — the answer to the problem. Example(s) sample input sample output 1 3 sample output 2 5 Solution Code: C++ #include <iostream> using namespace std ; // solved int main () { int x ; cin >> x ; cout << 2 * x + 1 << endl ; return 0 ; } Solu...

At last, Got the CS2 update #counterstrike #CS2 #CSGO

At last, Got the CS2 update... Happy ending of Counter Strike Global Offensive. New Era of CS2 #counterstrike #CS2 @CounterStrike #CSGO

Solving A. How Much Does Daytona Cost? in C++

A. How Much Does Daytona Cost? Problem - A - Codeforces - Codeforces Round 900 (Div. 3) Solving the Most Common Element Subsegment Problem in C++ Introduction: In the world of programming, problem-solving is a fundamental skill. It involves taking a complex task and breaking it down into smaller, manageable steps. In this blog post, we will dissect and solve a code problem that involves finding if a specific element exists in an array. The problem statement is as follows: Problem Statement: You are given an array of integers and an integer K. The task is to determine whether K exists in the given array. You will be provided with multiple test cases, each containing an array and a value of K. For each test case, you need to output "YES" if K is found in the array and "NO" otherwise. Solution: Let's break down the problem into steps and implement a solution in C++.Read the number of test cases (t) from input. Enter a loop that runs t times, one iteration for eac...

Codeforces round #900 (Div.3) Editorial

  Codeforces round #900 (Div.3) Editorial Thank you for participating in the first ever Serbian Div. 3 Codeforces round! Sorry Before the editorial, we are sorry for the big gap between problems C and D. This was the first round we ever created (except for  wxhtzdy ). We are striving to become better problem-setters and create more balanced problems-sets in the future. Also a massive thanks to  Vladosiya  for giving us a chance to create a divison 3 round! 1878A - How Much Does Daytona Cost? Problem was authored and prepared by Author:  wxhtzdy Prepared by:  ognjentesic ,  AndrewPav ,  AlphaMale06 Hints Hint 1 When is the answer definitely "NO"? Hint 2 What happens if there is no element equal to  k �  in the array? Hint 3 What happens if there is an element equal to  k �  in the array? Tutorial 1878A - How Much Does Daytona Cost? It's enough to check if there even exists the element equals to  K � , since  K �  ...

Popular posts from this blog

Whiteboarding Interviews

Version Control with Git: A Beginner’s Guide

Callback function in JavaScript