|
|
Common BoardPlease read "if a student has got satisfactory marks, the scholarship is not given" this statement again and again which means if in any of the subject a student gets 3.0 he will not get any scholarship. -------------------------------------------------- Пожалуйста, прочитайте «если студент получил удовлетворительные оценки, стипендия не предоставляется», это утверждение снова и снова означает, что если по какому-либо предмету студент получает 3,0 балла, он не получит стипендию. import java.util.Arrays; import java.util.Scanner; public class ppppp { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int g = in.nextInt(); if (0 <= n && n <= k && k <= g && g <= 100){ int[] mas = {n, k, g}; boolean isSorted = false; int buf; while (!isSorted) { { isSorted = true; for (int i = 0; i < mas.length - 1; i++) { if (mas[i] > mas[i + 1]) { isSorted = false; buf = mas[i]; mas[i] = mas[i + 1]; mas[i + 1] = buf; } } } } int da = mas[0] - mas[1] * mas[2]; System.out.println(da); } } } Да тут есть ошибка!В коде есть ошибка нужно посмотреть код заново!И выявить ошибку! ОТВЕТ ДЛЯ ЭТОЙ ЗАДАЧИ a-b-c or a-b*c это нужно вписать в код и все получится! lol Edited by author 15.12.2019 12:57 Edited by author 15.12.2019 12:57 Edited by author 15.12.2019 12:57 #include<bits/stdc++.h> using namespace std; int main() { unsigned long long int n; while(cin >> n) { cout << fixed << setprecision(9) << sqrt(n) << "\n"; } return 0; } Add test. My solution O(n^2) on python AC admins is died Edited by author 13.12.2019 06:53 Check all 2x2 squares A[i][j] A[i][j+1] A[i+1][j] A[i+1][j+1] Make sure you always can cover this square at least one of the methods x x y y or x y x y Edited by author 10.12.2019 14:13 Edited by author 10.12.2019 14:15 Check that you are dealing with an undirected graph! You need to minimize number of visited islands firstly. Test: 3 3 1 3 1 3 99 1 2 0 2 3 0 Answer: 2 0.99 1 3 Let we visit towns by distance ascending: 1, 2, 3 So total fine is : (6+5) + (5*2+3*2) + 3 = 11 + 16 + 3 = 30 Where am I wrong? My mistake: Total fine is : (6+5) + (5*2+3*2) + 3*3 = 11 + 16 + 9 = 36 What is test 8? What input ? Edited by author 13.11.2009 15:02 Edited by author 13.11.2009 15:02 Now all ok? i find my mistake. I solved the problem geometrically in Microsoft VS C ++. At first, my solution was WA 8, but after I added 100 to the input coordinates, I started getting WA 38. But as I did not try to work with accuracy, I still got WA 38. I tried everything. Please tell me, is 38 test really drawn up correctly? Or at least tell me what my mistake is. I would like to see a test similar to 38. I am sure that I solved the problem correctly you must sort in ascend and descend order !!! AC programm: 6 1 5 4 3 2 6 ans: 4 Edited by author 10.02.2011 11:10 deleted Edited by moderator 11.08.2022 18:56 var m,n,i,j,k,s,l:integer; A: array [1..15000] of LongInt; B: array [1..1000000] of LongInt; begin s:=0; readln(n); for i:=1 to n do readln(A[i]); readln(m); for j:=1 to m do begin readln(B[j]); end; i := 1; j := n; k := 1; for l:=1 to m do begin while (i <=j) do begin k := (i + j) div 2; if B[l] > A[k] then i := k + 1 else j := k -1;
end; if A[k] = B[l] then s:=s+1; end; writeln(); writeln(s); readln; end. Try this test: 3 10 11 12 3 12 11 10 result must be 3 or no :) Try this test: 3 10 11 12 3 12 11 10 In your program teacher's dates should not be the same. But once you will fix this your program won't pass test 8 because of time limit. You have to use binary search. And in binary search there can be the same teacher's dates. My code doesn't leave empty line after the last query. What can be the cause of WA2? Seeing many people also got WA2 :(( Edited by author 21.04.2017 07:33 Edited by author 21.04.2017 07:33 if no word found with any query dont print any new line Can someone help me? Please? I do it with Python3 ,and does not print out empty line after last queue here's my code: def getSecond(temp): return temp[1] if __name__ == '__main__': while True: try: N = int(input()) Words = [] for n in range(N): Words.append(input().split()) Words[n][1] = int(Words[n][1]) M = int(input()) Beginners = [] for m in range(M): Beginners.append(input()) for mm in range(M): start = list(Beginners[mm]) matchs = [] for nn in range(N): word = list(Words[nn][0]) flag = True for s in range(len(start)): if start[s] != word[s]: flag = False break if(flag): matchs.append(Words[nn]) if matchs != []: matchs.sort() matchs.sort(key = getSecond, reverse = True) count = 0 for match in matchs: if count > 10: break print(match[0]) count += 1
if mm != M-1: print() except: break
if no word found with any query dont print any new line |
|
|