yvN Posted October 8, 2020 Share Posted October 8, 2020 Hi guys, I'm having trouble solving this issue in .php, before I did it in .java but in php I don't know which way to go. Could anyone decide to compare it with the others? Quote Link to comment https://forums.phpfreaks.com/topic/311581-question-kattis-bijelephp/ Share on other sites More sharing options...
Barand Posted October 8, 2020 Share Posted October 8, 2020 Sounds a simple problem involving a couple of arrays and a loop. What have you tried so far? Quote Link to comment https://forums.phpfreaks.com/topic/311581-question-kattis-bijelephp/#findComment-1581779 Share on other sites More sharing options...
yvN Posted October 8, 2020 Author Share Posted October 8, 2020 I did it in .java but I don't know how to switch to .php  import java.util.Scanner; public class bijele { public static void main (String[] args) { Scanner in = new Scanner(System.in); int[] neededPieces = {1,1,2,2,2,8}; String[] currentPieces = in.nextLine().split(" "); for (int i = 0; i < 6; i++) { neededPieces[i] -= Integer.parseInt(currentPieces[i]); System.out.print("" + neededPieces[i] + " "); } } }  Quote Link to comment https://forums.phpfreaks.com/topic/311581-question-kattis-bijelephp/#findComment-1581780 Share on other sites More sharing options...
Barand Posted October 8, 2020 Share Posted October 8, 2020 https://www.php.net/manual/en/language.types.array.php Quote Link to comment https://forums.phpfreaks.com/topic/311581-question-kattis-bijelephp/#findComment-1581783 Share on other sites More sharing options...
yvN Posted October 8, 2020 Author Share Posted October 8, 2020 how would you convert for me? did not quite understand Quote Link to comment https://forums.phpfreaks.com/topic/311581-question-kattis-bijelephp/#findComment-1581784 Share on other sites More sharing options...
Barand Posted October 8, 2020 Share Posted October 8, 2020 1 minute ago, yvN said: did not quite understand it is a link to the PHP reference manual's section on arrays. Read it. 1 Quote Link to comment https://forums.phpfreaks.com/topic/311581-question-kattis-bijelephp/#findComment-1581785 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.