|
|
Common Board Edited by author 21.10.2021 22:47 #include <iostream> #include <vector> #include <cmath> using namespace std; int main() { long long val = 0; vector<double> v; while (cin >> val &&val!=EOF) { v.push_back(sqrt(val)); } for (int i = v.size()-1; i >=0; i--) { cout<< v[i] << endl; } return 0; } Set your val type to double for (int i = v.size()-1; i >=0; i--) { cout << fixed << setprecision(4) << v[i] << endl; } use this. your program is supposed to print 4 points for (int i = v.size()-1; i >=0; i--) { cout << ios::fixed << setprecision(4) << v[i] << endl; } try to change "long long val" to "double val" Some AC to try this test BID 0.01 BID 10000 BID 5000 BID 5000 SALE 5000 3 DEL 5000 SALE 3000 3 SALE 0.01 3 QUIT Hint: ->, not <-> Rot13: Gur qenhtug bayl zbirf sbejneq jura chfurq, abg ovqverpgvbanyyl. the reason is min(ti+(ti*T+99)/100,100500*ti) can overflow. So you are supposed to change long long into unsigned long long,then you'll get AC. I think that this is too easy problem for 297 points of hardness This case may help you: 2 A B C B D Isenbaev ans: A 2 B 1 C 2 D 1 Isenbaev 0 Change the statement, don't be ashamed Try this: 3 3 2 2 3 3 answer: 4 What is answer, if input is: 42 c cc ccc cccc ccccc ccccccca cccccccb cccccccc cccccccd ccccccce cccccccf cccccccg ena enb enc enf eng enh enl enm ens enss enssa enssb enssc enssd ensse enssf ensst ensstu ensstz z zz zza zzb zzc zzd zze zzf zzg zzh zzj Anybody help, please! 0 1 2 3 4 5 6 7 7 6 5 4 2 3 4 5 5 6 7 5 7 8 9 10 9 8 7 6 5 4 3 4 5 6 7 7 6 5 4 3 2 1 :( My answer is the same, but i got wa2. But thanks you anyway. Edited by author 21.11.2011 13:39 It's wrong answer. For example, for i=9 answer <=6 (not 7): e (+2), up (+4) Edited by author 07.08.2016 15:21 The answer is correct.My AC program get the same answer with it. I wish they made clarification My friends solve it with dicnic. But its time complexity can be up to O(nm^sqrt(n+m)),and its space compexity can be up to O(nm). I think admin should add the test that all the bank belong to one country. I see many people had this WA. Can someone give me a hint about it? I think it will be useful for others. I had WA 4 because of wrong supposition: let probabilities are p0=1.0, p1, p2 p1 > p2 "p1" always should shoot into "p0" "p2" always should shoot into the air Thank you! There are really much more cases. Another way is to type (i-1) instead of (1-i) somewhere in your code without noticing and then spend 90 minutes going over the code and try to figure out how your logic could possibly be wrong. #include <iostream> using namespace std; main() { int a, b ; int a1 , b1; int a2 , b2; cin >> a >> b; cin >> a1 >> b1; cin >> a2 >> b2;
int c = b - b1; int c1 = a - a2; cout << c1 << " " << c; return 0; } ____________________________________ Держите) Не правильно #include <iostream> using namespace std; main() { int a, b ; int a1 , b1; int a2 , b2; cin >> a >> b; cin >> a1 >> b1; cin >> a2 >> b2;
int c = b - b1; int c1 = a - a2; cout << c1 << " " << c; return 0; } ____________________________________ Держите) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner a = new Scanner(System.in); int x = a.nextInt(); //String x1 = a.nextLine(); int y = 0; int z = 0; int [] array1 = new int[x]; for(int i=0;i<x;i++) { array1[i] = a.nextInt(); y+=array1[i];
if(i==1 && array1[i] < array1[i-1] ) { int tmp = array1[i]; array1[i] = array1[i-1]; array1[i-1] = tmp; } }
for(int i=array1.length-1;i>-1;i--) { z+=array1[i]*y; y-=array1[i]; z+=array1[i]*y; }
System.out.println(z); } } #include <iostream> int main() { short n;int a=0; std::cin>>n; if(n<=0){ for(int i=n;i<=1;i++){ a+=i; } std::cout<<a; } else{ for(int i=1;i<=n;i++){ a+=i; } std::cout<<a; } return 0; } The answer is the symmetry axis In test 3 the angle between the lines is very small Edited by author 26.06.2015 02:34 thx! <code> #include <stdio.h> int main(){ printf("1 1 0\n0 0 0\n180\n"); } </code> gives WA3 ^) Почему так не проходит(ошибка на 13): #include <iostream> int main() { int n,k; std::cin>>n>>k; if(n<=k) std::cout<<2; else std::cout<<n*2/k+n*2%k; return 0; } А так проходит: #include <iostream> int main() { int n,k; std::cin>>n>>k; if(n<=k) std::cout<<2; else{ if(n*2 % k == 0) std::cout<<n*2/k; else std::cout<<n*2/k+1; } return 0; } Ну или тернар(тоже не проходит - ошибка на 13): #include <iostream> int main() { int n,k; std::cin>>n>>k; (n<=k)?std::cout<<2:std::cout<<n*2/k+n*2 % k; return 0; } Может я чего не понимаю, может всё-таки где-то приоритет потерял, но ведь идентично же. Edited by author 08.10.2021 11:51 Теперь понял, %k может вернуть и больше, чем 1 Edited by author 08.10.2021 12:00 Edited by author 08.10.2021 12:02 C++ ответ: #include <iostream> int main() { int n,k; std::cin>>n>>k; (n<=k)?std::cout<<2:(n*2%k==0)?std::cout<<n*2/k:std::cout<<n*2/k+1; return 0; } Edited by author 08.10.2021 12:03 I have some mistake in the staion name which I can't find it in my code. Then I search all the string my write and calculate LCS. The string has maximal LCS is what we want to find. Like that: int __(string ss){ if(f.find(ss)==f.end()){ int ans=0,pos=0; rep(ki,1,cnt){ mst(dp,0); for(int i=1;i<=ss.length();i++){ for(int j=1;j<=s[ki].length();j++){ if(ss[i-1]==s[ki][j-1])dp[i][j]=dp[i-1][j-1]+1; else dp[i][j]=max(dp[i-1][j],dp[i][j-1]); } } if(dp[ss.length()][s[ki].length()]>ans)ans=dp[ss.length()][s[ki].length()],pos=ki; } return pos; } return f[ss]; } Then I got AC from wa2 Edited by author 08.10.2021 04:46 |
|
|