Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0a962a6

Browse files
solveAtcoderProblem
1 parent 3b029be commit 0a962a6

File tree

37 files changed

+250
-165
lines changed

37 files changed

+250
-165
lines changed

‎.idea/workspace.xml

Lines changed: 33 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Atcoder/PHP/203.ABC/A.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
$moriyama = explode('', trim(fgets(STDIN)));
3+
4+
sort($moriyama);
5+
if ($moriyama[0] == $moriyama[1]) {
6+
echo $moriyama[2];
7+
} elseif ($moriyama[1] == $moriyama[2]) {
8+
echo $moriyama[0];
9+
} else {
10+
echo '0';
11+
}

‎Atcoder/PHP/203.ABC/A.tpl

Lines changed: 0 additions & 9 deletions
This file was deleted.

‎Atcoder/PHP/203.ABC/B.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
2-
fscanf(STDIN, "%d%d",$mori, $yama);
2+
fscanf(STDIN, "%d%d",$mori, $yama);
33
$evisjap = 0;
44

5-
for($i=1;$i<$mori+1;$i++){
6-
for($j=1;$j<$yama+1;$j++){
7-
$evisjap += $i*100+$j;
8-
}
5+
for($i = 1; $i < $mori + 1; $i++){
6+
for($j = 1; $j < $yama + 1; $j++){
7+
$evisjap += $i * 100 + $j;
8+
}
99
}
1010
echo $evisjap;

‎Atcoder/PHP/209.ABC/A.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
fscanf(STDIN, "%d%d", $mori, $yama);
3-
if($mori>$yama || $mori == $yama){
4-
echo '0';}else{
5-
echo $yama-$mori+1;
3+
if ($mori > $yama || $mori == $yama) {
4+
echo '0';
5+
} else {
6+
echo $yama - $mori + 1;
67
}

‎Atcoder/PHP/209.ABC/B.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
<?php
2-
fscanf(STDIN, "%d", $moriyama);
3-
$kes =explode("",trim(fgets(STDIN)));
2+
fscanf(STDIN, "%d%d", $mori, $yama);
3+
$moriyama = explode("",trim(fgets(STDIN)));
44

5-
sort($kes);
6-
$evisjap = 1;
7-
$taku = 1000000007;
8-
for($i=0;$i<$moriyama;$i++){
9-
$evisjap = ($evisjap*($kes[$i]-$i))%$taku;
5+
$evisjap = 0;
6+
$fuji = [];
7+
foreach ($moriyama as $taku => $evis) {
8+
if ($taku % 2 != 0) {
9+
array_push($fuji, $evis - 1);
10+
} else {
11+
$evisjap += $evis;
12+
}
1013
}
11-
echo $evisjap;
14+
if ($evisjap + array_sum($fuji) <= $yama) {
15+
echo "Yes";
16+
} else {
17+
echo "No";
18+
}

‎Atcoder/PHP/209.ABC/B.tpl

Lines changed: 0 additions & 16 deletions
This file was deleted.

‎Atcoder/PHP/209.ABC/C.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
fscanf(STDIN, "%d", $moriyama);
3+
$kes = explode("", trim(fgets(STDIN)));
4+
5+
sort($kes);
6+
$evisjap = 1;
7+
$taku = 1000000007;
8+
for ($i = 0; $i < $moriyama; $i++) {
9+
$evisjap = ($evisjap * ($kes[$i] - $i)) % $taku;
10+
}
11+
echo $evisjap;

‎Atcoder/PHP/210.ABC/A.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
22
fscanf(STDIN, "%d%d%d%d", $moriyama, $kes, $mori, $yama);
33

4-
$evija = $moriyama-$kes;
5-
if($moriyama<=$kes){
6-
echo $moriyama*$mori;}else{
7-
echo $kes*$mori+$evija*$yama;
4+
$evija = $moriyama - $kes;
5+
if ($moriyama <= $kes) {
6+
echo $moriyama * $mori;
7+
} else {
8+
echo $kes * $mori + $evija * $yama;
89
}

‎Atcoder/PHP/210.ABC/B.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
fscanf(STDIN, "%s", $moriyama);
3+
fscanf(STDIN, "%s", $kes);
4+
5+
$fuji = str_split(trim($kes));
6+
$evisjap = array_search("1", $fuji);
7+
8+
if ($evisjap % 2 == 0) {
9+
echo "Takahashi";
10+
} else {
11+
echo "Aoki";
12+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /