Instantly share code, notes, and snippets.

Busy

# Thameem Karakkoththameemk612

Busy
• Sort options
Created Oct 1, 2018
View 1
 #define C1A 4 #define C1B 5 #define C2A 6 #define C2B 7 void setup() { pinMode(C1A,OUTPUT); pinMode(C1B,OUTPUT); pinMode(C2A,OUTPUT); pinMode(C2B,OUTPUT); }
Created Oct 2, 2018
View 2
 #include SoftwareSerial myserial(2,3); //RX & TX String voice; #define C1A 13 //right side #define C1B 7 #define C2A 8 //left side #define C2B 7 void setup(){ myserial.begin(9600); Serial.begin(9600);
Created Oct 18, 2018
View 1
 One fine day, Little Achu set out for the playground near his home to play touch and run. Since none of his friends were there, he decided to play the game all by himself. Achu noticed that the playground is of the dimension n × m, a rectangular field. The squares have coordinates (x, y) (1 ≤ x ≤ n, 1 ≤ y ≤ m), where x is the index of the row and y is the index of the column. Initially, Achu stands in the square with coordinates (xc, yc). To play, he has got a list of k vectors (dxi, dyi) of non-zero length. The game goes like this. Achu considers all vectors in the order from 1 to k, and consecutively chooses each vector as the current one. After the boy has chosen a current vector, he makes the maximally possible number of valid steps in the vector's direction (it is possible that he makes zero steps). A step is defined as one movement from the square where the boy is standing now, in the direction of the current vector. That is, if Achu is positioned in square (x, y), and the current vector is (dx, dy),
Created Oct 18, 2018
View 3
 When E-mail addresses are spelled out, one pronounces a . as dot, an @ sign as at. As a result, we get something like blasphemy98atyahoodotcom . We need to obtain the real mail ID from this like - blasphemy98@yahoo.com . It is known that a proper email address contains only such symbols as . @ and lower-case Latin letters, doesn't start with and doesn't end with a dot. Also, a proper email address doesn't start with and doesn't end with an at sign. Moreover, an email address contains exactly one such symbol as @, yet may contain any number (possible, zero) of dots. A series of replacements has to be made so that the length of the result is as short as possible and it is a valid email address. If the lengths are equal, the lexicographically minimal result should be printed. Example : Input codertowinatgmaildotcom Ouput
Created Oct 18, 2018
View 4
 Find the greatest common divisor d between two integers a and b that is in a given range from low to high (inclusive), i.e. low ≤ d ≤ high. It also is possible that there is no common divisor in the given range. You will be given the two integers a and b, then n queries. Each query is a range from low to high and you have to answer each query. Input The first line contains two integers a and b, the two integers as described above (1 ≤ a, b ≤ 109). The second line contains one integer n, the number of queries (1 ≤ n ≤ 104). Then n lines follow, each line contains one query consisting of two integers, low and high (1 ≤ low ≤ high ≤ 109). Output Print n lines. The i-th of them should contain the result of the i-th query in the input. If there is no common divisor in the given range for any query, you should print -1 as a result for this query. Input Format
Created Oct 18, 2018
View 5
 You have got a new job, and it's very interesting, you are a ship captain. Your first task is to move your ship from one point to another point, and for sure you want to move it at the minimum cost. And it's well known that the shortest distance between any 2 points is the length of the line segment between these 2 points. But unfortunately there is an island in the sea, so sometimes you won't be able to move your ship in the line segment between the 2 points. You can only move to safe points. A point is called safe if it's on the line segment between the start and end points, or if it's on the island's edge. But you are too lucky, you have got some clever and strong workers and they can help you in your trip, they can help you move the ship in the sea and they will take 1 Egyptian pound for each moving unit in the sea, and they can carry the ship (yes, they are very strong) and walk on the island and they will take 2 Egyptian pounds for each moving unit in the island. The money which you will give to them
Created Oct 18, 2018
View 6
 In a very large firm in South London, there is a cloakroom with a coat hanger. It has n hooks positioned in a row. The hooks are numbered with positive integers from 1 to n from left to right. The firm workers have a very complex work schedule. At the beginning of a work day, all the workers are not there and the coat hanger in the cloakroom is empty. At some moments of time the workers arrive and some of them leave. When some employee arrives, he hangs his cloak on one of the available hooks. To be of as little discomfort to his colleagues as possible, the hook where the coat will hang, is chosen like this. First the employee chooses the longest segment among available hooks following in a row. If there are several of such segments, then he chooses the one closest to the right. After that the coat is hung on the hook located in the middle of this segment. If the segment has an even number of hooks, then among two central hooks we choose the one closest to the right. When an employee leaves, he takes his c
Created Oct 18, 2018
View 7
 Manu needs money and decides to open his uncle’s locker. He knows that the passcode of the locker consists of n numbers, and every number is a 0 or 1. Manu has made m attempts to enter the code. After each attempt the system told him in how many position stand the right numbers. It is not said in which positions the wrong numbers stand. Manu has been so unlucky that he hasn’t entered the code where would be more than 5 correct numbers. Now Manu is completely bewildered: he thinks there’s a mistake in the system and it is self-contradictory. Calculate how many possible code variants are left that do not contradict the previous system responses. Input The first input line contains two integers n and m which represent the number of numbers in the code and the number of attempts made by Manu. Then follow m lines, each containing space-separated si and ci which correspondingly indicate Manu’s attempt (a line containing n numbers which are 0 or 1) and the system’s response (an integer from 0 to 5 inclusively). Ou
Created Mar 3, 2019