How to solve problem using PHP

All general topics that Dev Skill members should discuss.

How to solve problem using PHP

by devskill » Tue Sep 20, 2016 3:54 pm

You can use the below code sample for input / output for PHP. We have tested it that it solves our archive problem:

Code: Select all

$stdin = fopen('php://stdin', 'r');
$stdout = fopen('php://stdout', 'w');
//$line = trim(fgets(STDIN)); // reads one line from STDIN
fscanf(STDIN, "%d\n", $testcase); // reads number from STDIN
for($i =0; $i<$testcase; $i++)
   fscanf(STDIN, "%d %d %d %d\n", $x1, $y1, $x2, $y2);
   $result = abs($x2 - $y2) + abs($x1 - $y1);

   fprintf(STDOUT, "Case %d: %d\n", $i+1, $result);
User avatar
Site Admin
Posts: 118
Joined: Tue Feb 02, 2016 10:24 pm

Re: How to solve problem using PHP

by BishalG » Thu Apr 20, 2017 9:33 am

C# Sample code is available in Dev Skill Code Editor for every problems.
The sample is given below:

Code: Select all
using System;
public class Test
   public static void Main()
User avatar
Posts: 43
Joined: Tue Jan 17, 2017 10:10 pm

Who is online
Users browsing this forum: No registered users and 0 guests