Common BoardPrecalculate pythagorean tripples 9 3 9 8 2 3 7 3 1 2 4 2 2 5 3 3 7 6 4 3 9 8 5 2 5 2 2 6 1 2 6 1 Please try this data,please My progame can't pass this,but I got AC My code: n,m = map(int, input().split()) dct = dict() for i in range(m): a = input() if a not in dct: dct[a] = 1 else: dct[a] += 1 for i in dct: print("{0:.2f}%".format((dct[i]/m)*100)) Where is mistake? Edited by author 13.09.2021 21:32 Hint: you should only know fundamental theorem of arithmetic It's easy if you know that number of divisors is (n_1+1)*(n_2+1)*...*(n_k+1), where n_i is power of prime that is included in number decomposition The question stated that 0 < N < 30. However, in test case #9 N is exactly 30, contradicting the constraint. The test has been fixed. The solutions have been rejudged, making some solutions submitted before adding this test rejected and some submitted after adding it accepted. Посоветуйте пожалуйста сайты, где есть хорошая музыка в формате мп3 (не только русская), но также и зарубежная. Никто не знает? Edited by author 11.09.2021 19:41 На ютубе есть много шикарных подборок, которые тебя приятно удивят своим многообразием! Edited by author 12.09.2021 00:20 Представляю Вашему вниманию музыкальный ресурс от сайта http://mp3uk.net где можно бесплатно скачать новую музыку в mp3 формате или слушать онлайн! Скачивайте музыку прямо с сайта со своего мобильного телефона, планшета или компьютера. Сайт работает круглосуточно! First I got WA#22 while I used double than I change to use longdouble instead of double and I got WA#24 After that I change floor(x)/ceil(x) to floor(x+esp)/ceil(x-esp) and I got WA#24 too But when I try to use double again I got AC! [It's strange,too strange.I hate Accuracy issues] (Sorry for my poor English XP) Edited by author 07.09.2021 16:36 I guess that case is sth like a==0(a=-5Nz) ,b!=0 (b= VxNx+VyNy+VzNz) (I find a check t=c/b instead of t=-b/c by mistake,and got wa) there are 24 unique sequences of edges for the specific cube, i use 12 sequences and flip flop front with back for each of them static int R[][] = new int[][] { {1,2,3, 4,5, 6}, {5,3,1, 4,2, 6}, {2,1,5, 4,3, 6}, {3,5,2, 4,1, 6},
{6,4,3, 1,5, 2}, {5,3,6, 1,4, 2}, {4,6,5, 1,3, 2}, {3,5,4, 1,6, 2}, {1,2,6, 3,4, 5}, {6,4,2, 3,1, 5}, {2,1,4, 3,6, 5}, {4,6,1, 3,2, 5} }; static int front_back_rotate[][] = new int[][]{{0,1,2,3,4,5},{0,1,4,5,2,3}}; //left right top front bottom back //0 1 2 3 4 5 static boolean eqv(int a[], int b[]) { for (int[] r: R) { for (int[] I: front_back_rotate) { int front_back[] = new int[6]; for (int i=0; i<6; i++) { front_back[r[I[i]]-1] = a[i]; } if (Arrays.equals(front_back, b)) return true; } } return false; }
You don't need to try all rotation combinations. Just rotate left and rotate down, use recursion and all combinations will be generated easily. If you are from Russia, this should be clear) That should be very good programmers :) Edited by author 08.09.2021 15:24 Edited by author 08.09.2021 15:24 Take attention: No matter whose turn it is,if all the color is A,than Alise win,else Bob win. Just like the title,I know how to solve this problem,becouse I have played the game before,and I know there is a way to move the chess.But if somebody dosen't play the game at all before,than how can he solve the problem?(Sorry for my poor English) Edited by author 03.09.2021 16:00 #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> int main() { int n, k; scanf("%d %d", &n, &k); if (n < 1 || n > pow(10, 9) || k < 1 || k > pow(10, 9)) { return 0; } unsigned long long result = 0; unsigned long long buffer = 1; n--; for (int i = 0; n >= 0; i++) { n -= buffer; result++; buffer *= 2; if (n <= 0) { printf("%llu\n", result); return 0; } if (buffer >= k) { buffer = k; double count = (double)n / buffer; if (count != (long long)count) { count++; } result += count; printf("%llu\n", result); return 0; } } return 0; } Edited by author 21.01.2020 01:57 Give me some tests. Some my tests Input: 3 9 2 1 3 1 4 1 1 1 5 3 1 2 1 3 1 2 1 Output: G 1 2 Input: 1 5 2 3 1 4 5 Output: G 1 3 Input: 1 5 5 4 1 3 2 Output: G 1 1 Edited by author 25.09.2007 20:24 AAAA, yea, how stupid was I(( using System; using System.Linq; namespace e3 { class Program { public static void Main(string[] args) { int k=int.Parse(Console.ReadLine()); int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray(); int temp; for (int i = 0; i < k - 1; i++) { for (int j = 0; j < k - i - 1; j++) { if (arr[j] > arr[j + 1]) { // меняем элементы местами temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } }
int s=0; for (int i = 0; i < k/2+1; i++) { s=s+(arr[i]/2+1); } Console.WriteLine(s);
} } } Edited by author 28.08.2021 19:25 |
|