Сообщения

Сообщения за октябрь, 2017
542 | Поставка содовой воды Java Solution: import java.util.Scanner ; public class solution_9 { public static void main (String[] args){ Scanner scn = new Scanner(System. in ) ; int e = scn.nextInt() , f = scn.nextInt() ; int c = scn.nextInt() , fb = 0 ; e = e + f ; while (c <= e){ int n = e / c ; e = n + e % c ; fb += n ; } System. out .println(fb) ; } }
520 | Сумма всех Java Solution: import java.util.Scanner ; public class solution_8 { public static void main (String[] args) { Scanner in = new Scanner(System. in ) ; long sum = 0 ; while (in.hasNextInt()) sum += in.nextInt() ; System. out .println(sum) ; } }
518 | Сумма двух Java Solution: import java.util.Scanner ; public class solution_7 { public static void main (String[] args){ Scanner scn = new Scanner(System. in ) ; int t = scn.nextInt() ; int num[][] = new int [t][ 2 ] ; for ( int i = 0 ; i < t ; i++){ num[i][ 0 ] = scn.nextInt() ; num[i][ 1 ] = scn.nextInt() ; } for ( int i = 0 ; i < t ; i++){ System. out .println(num[i][ 0 ] + num[i][ 1 ]) ; } } }
513 |  Проблема Николая Java Solution: import java.util.Scanner ; public class solution_6 { private static int func ( int n , int m){ int res = 1 , i = 0 ; for (res = i = 1 ; i <= n ; i++) res = (res * i) % m ; return res ; } public static void main (String[] args){ Scanner scn = new Scanner(System. in ) ; int n = scn.nextInt() , m = scn.nextInt() ; if (n >= m){ System. out .print( 0 ) ; } else { System. out .print( func (n , m)) ; } } } Attention! 80% successful! pppp
497 | Лентяй C++ Solution: #include <iostream> using namespace std; int mas[35] = {0}; int main{ int t,i,j,n,r,a,b,f; cin >> t; for (i = 0 ; i < t ; i++) { cin >> n; for (j = 0 ; j < 35 ; j++) mas[j] = 0; for (j = 0 ; j < n ; j++) { cin >> a >> b; for (r = a ; r <= b ; r++) mas[r]++; } f = 0; for (r = 0 ; r < 35 ; r++){ if (mas[r] == n){ f = 1; break; } } if (f == 1) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
446 | Ровные делители Java Solution: import java.util.Scanner ; public class solution_4 { public static void main (String[] args){ Scanner scn = new Scanner(System. in ) ; int n = scn.nextInt() , counter = 0 ; for ( int i = 2 ; i <= n ; i++){ if ((n/i) == (n%i)){ ++counter ; } } System. out .println(counter) ; } }
421  | Йо-йо Java Solution: import java.util.Scanner ; public class solution_3 { public static void main (String[] args){ Scanner scn = new Scanner(System. in ) ; double l = scn.nextInt() , k = scn.nextInt() ; int counter = 0 ; l /= k ; try { while (l > 1 ) { l /= k ; ++counter ; } } catch (Exception e){ e.getMessage() ; } System. out .print(counter) ; } }
407 | Обмен Python Solution: nlen = input() ; n = [] ; for i in range( int (nlen)): n = n + [ int (input())] ; for i in range( int (nlen)): if (( int )(n[i]) % 3 == 0 ): print( 'GCV' ) ; if (( int )(n[i]) % 3 == 1 ): print( 'VGC' ) ; if (( int )(n[i]) % 3 == 2 ): print( 'CVG' ) ;
388 | Превращение Java Solution: import java.util.Scanner ; public class solution_1 { public static void main (String[] args){ Scanner scn = new Scanner(System. in ) ; int n = scn.nextInt() , counter = 0 ; try { while (n != 1 ){ if (n % 2 == 0 ){ n /= 2 ; counter++ ; } else { n += 1 ; counter++ ; } } } catch (Exception e){ e.getMessage() ; } System. out .print(counter) ; } }