Solutions
This commit is contained in:
commit
0ef619e034
13 changed files with 730 additions and 0 deletions
38
FACILE/ASCII Art/script.php
Normal file
38
FACILE/ASCII Art/script.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Auto-generated code below aims at helping you parse
|
||||
* the standard input according to the problem statement.
|
||||
**/
|
||||
|
||||
fscanf(STDIN, "%d",
|
||||
$L
|
||||
);
|
||||
fscanf(STDIN, "%d",
|
||||
$H
|
||||
);
|
||||
|
||||
$T = stream_get_line(STDIN, 256, "\n");
|
||||
|
||||
$T = preg_replace('/\W/', '?', $T);
|
||||
|
||||
$lines = [];
|
||||
$outputLines = [];
|
||||
|
||||
for ($i = 0; $i < $H; $i++)
|
||||
{
|
||||
$lines[] = stream_get_line(STDIN, 1024, "\n");
|
||||
$outputLines[] = '';
|
||||
}
|
||||
|
||||
$letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ?';
|
||||
|
||||
for ($u = 0; $u < strlen($T); $u++) {
|
||||
$position = strpos($letters, strtoupper($T[$u]));
|
||||
$offsetLeft = $position * $L;
|
||||
|
||||
foreach($lines as $k => $line) {
|
||||
$outputLines[$k] .= substr($lines[$k], $offsetLeft, $L);
|
||||
}
|
||||
}
|
||||
|
||||
echo implode("\n", $outputLines), "\n";
|
||||
Loading…
Add table
Add a link
Reference in a new issue