åèš756人ãæåã®äºéžã«åå ããŸããã ã©ãŠã³ãã®çµæã«ãããšãæé«200人ã®åå è ãã6æ19æ¥ã«éå¬ãããäºéžã©ãŠã³ãã«åå ããããšãèš±å¯ãããŸããã
5æ14æ¥ãš15æ¥ã«ã2åç®ãš3åç®ã®è³æ Œå¯©æ»ãè¡ãããããã«400åãéžåºãããŸãã
ãã®èšäºã§ã¯ãRCCã®ç¬¬1段éã®ããŸããŸãªçµ±èšãåæããã¿ã¹ã¯ãåæããŠããã¢ãŒäžã«åãåã£ãæããããã質åã«çããŸãã
åå è ã解決ããããã«ã審æ»å¡ã¯5ã€ã®ã¿ã¹ã¯ãææ¡ããŸããã å°ãªããšã1ã€ã®åé¡ã691人ã®åå è ã«ãã£ãŠè§£æ±ºãããŸããã åé¡Aãæãç°¡åã§ããããšãå€æãã685人ã®åå è ãããã解決ããŸããã äžè¬çã«ãæ£ãã決å®ã¯æ¬¡ã®ã¿ã¹ã¯ã«åŸã£ãŠé åžãããŸããã
å³1.åé¡ã®æ£ãã解決çã®æ°ã
å³ãããããããã«ãã¿ã¹ã¯AãBãããã³Cã¯å€§å€æ°ã®åå è ã«éä¿¡ãããŸããããDããã³Eã¯ã¯ããã«è€éã§ããããšãå€æããŸããã ãããã®ã¿ã¹ã¯ã¯ã3ã€ã®ç°¡åãªåé¡ã解決ãã2ã€ã®å°é£ãªåé¡ã®å°ãªããšã1ã€ãäºéžã©ãŠã³ããžã®ã¢ã¯ã»ã¹ãä¿èšŒãããè³æ Œèªå®ã®æåã®éµãšãªããŸããã
ãããã3ã€ã®åé¡ã解決ããåå è ã¯ãåé¡è§£æ±ºã®é«éæ§ãå®èšŒããããã«å¿ èŠã§ããã 200äœã®ãã«ãããªããã¯ããã«ãã£æéã«å¿ããŠè¡ãããŸããã3ã€ã®ã¿ã¹ã¯ã§äºéžã©ãŠã³ãã«åå ããã«ã¯ã141æé以äžã®ããã«ãã£æéãã€ãŸã1ã€ã®ã¿ã¹ã¯ã«å¹³å23.5åãè²»ããå¿ èŠããããŸããã
å³2.解決ãããã¿ã¹ã¯ã®æ°ã«å¿ããåå è ã®æ°ã
ã¿ã¹ã¯Bã§æ倧ã®è©Šè¡ãè¡ãããã®ã¯1952幎ã§ããããæåããã®ã¯çŽ461ã§ãçŽ24ïŒ ã§ããã äžè¬ã«ãã¿ã¹ã¯ã§æåããè©Šè¡ã®å²åã¯æ¬¡ã®ããã«ãªããŸãã
å³3.ã¿ã¹ã¯ã§æåããè©Šè¡ã®å²åã
åé¡Cã解決ããåå è ã¯å°ãªãã£ããã®ã®ãåé¡Bã«æ¯ã¹ãŠåé¡ãå°ãªãã£ãããšãããããŸãã
ãã·ã¢ã³ãŒãã«ããã®åå è ã䜿çšããããã°ã©ãã³ã°èšèªã®çµ±èšãèŠãã®ã¯èå³æ·±ãã§ãã åèšæ°éãåã°ã©ãã«è»¢éãããšã次ã®å³ã衚瀺ãããŸãã
å³4.ããã°ã©ãã³ã°èšèªã«å¿ãã決å®ã®æ°ã
GNU Cã¯ããªã倧ããªå·®ã§ãªãŒããŒã§ãããJavaãšCïŒã®å æçã¯åèšã§çŽ3åã®1ã§ãä»ã®èšèªã§ã¯ããã«å°ãªãã¢ãããŒããè¡ãããŠããŸãã
èå³æ·±ãããšã«ãé·ãæŒç®ãå¿ èŠãšãã5çªç®ã®ã¿ã¹ã¯ã¯ãäž»ã«Javaã§è§£æ±ºãããŸããã
äžè¬ã«ãéä¿¡ããã決å®ã®ã競äºã®è°äºé²ã«ããååžã¯ã次ã®ãã£ãŒãã§èŠãããšãã§ããŸãã
å³4.競æã®æéã«å¿ããã¢ãããŒãã®æ°ã
æåã®æ°åã§åå è ãã¿ã¹ã¯ãèªãã åŸã匷ãåå è ã®å€§éšåãæåã®ã¿ã¹ã¯ã«å¯ŸåŠãããšãã«æ¥æ¿ãªæ¥å¢ãããããããã«æžå°ãããã®åŸãã¢ãããŒãã®æ°ã¯æ¯å30ãã50ã®ç¯å²ã§ãããã©ãŠã³ãã®çµããã«ã¯æ倧90ã®æ¥å¢ãèŠãããŸããã åæã«ã競äºã®å§ãã«æ£ãã決å®ãäž»ã«æ€èšŒã®ããã«éãããå Žåãæ£ãã決å®ã®å²åã¯çå®ã«æžå°ããŸããã 次ã®ã°ã©ãã¯ã競äºã®è°äºé²ã«å¿ããŠãæ€èšŒã®ããã«éä¿¡ããã決å®ã®ãã¡æ£ãã決å®ã®å²åã®äŸåæ§ã瀺ããŠããŸãã
å³5.競äºã®æéã«å¿ããæåããã¢ãããŒãã®å²åã
ã¿ã¹ã¯ã®è§£æ
ã¿ã¹ã¯A.æååã®é£çµ
å€ãã®ã¢ããªã±ãŒã·ã§ã³ã§ã¯ãããŸããŸãªæååæäœãå¿ èŠã§ãã 2ã€ã®ããªãäžè¬çãªæäœã¯ãè¡ã®åºãããš2ã€ä»¥äžã®è¡ã®é£çµã§ãã
æååsã®å転ã®çµæãæåås RãååŸãããŸããããã¯ãsãšåãæåã§æ§æãããŠããŸãããéã®é åºã«ãªã£ãŠããŸãã ããšãã°ãæååãabcdeããå±éããçµæãæååãedcbaããååŸãããŸãã ããã«ãã®åé¡ã§ã¯ãè¡šèšs Rã®ä»£ããã«è¡šèšïŒsïŒã䜿çšãããŸãã
2ã€ã®æååsãštãé£çµããçµæãæåås tãååŸããŸããæååsã®æåãæåã«æžã蟌ãŸãã次ã«æååtã®æåãæžã蟌ãŸããŸãã åæ§ã«ã3ã4ããŸãã¯ãã以äžã®ã¹ããªã³ã°ã®é£çµãå®çŸ©ãããŠããŸãã ããšãã°ãæååãabcããšãcdaããé£çµãããšãæååãabccdaãã«ãªããŸã
ããªãã®ä»äºã¯ãããã€ãã®è¡ãé£çµããçµæã決å®ããããšã§ãããã®ããã€ãã¯æ¡åŒµããå¿ èŠããããŸãã
å ¥å圢åŒ
å ¥åã¯ãå°æåã®ã©ãã³æåãšæ¬åŒ§ã®ã¿ãå«ã1è¡ã§æ§æãããŸãã ãã®é·ãã¯200æåãè¶ ããŸããã ãã®è¡ã¯ãããã€ãã®è¡ãé£çµãããã®ã§ããã®äžéšã¯æ¡åŒµããå¿ èŠããããŸãã
åéå§ãã©ã±ããã®å³åŽã®æå®ã®è¡ã«ã¯éãããããåéããã©ã±ããã®å·ŠåŽã«ã¯éå§ãããã察å¿ããéå§ãã©ã±ãããšçµäºãã©ã±ããã®éã«ä»ã®ãã©ã±ããã¯ãªããå°ãªããšã1ã€ã®æåãå¿ èŠã§ãã
åºå圢åŒ
é£çµã®çµæãåºåããŸãã
解決ç
ãã®ã¿ã¹ã¯ã¯ã競äºã§æãç°¡åã§ããã å¶éã¯éåžžã«å°ãããåççãªæ¹æ³ã§åé¡ã解決ã§ããŸãã ããšãã°ãæååãèªã¿åããåºåãæåãšããŠæ¬åŒ§ã䜿çšããŠãã©ã°ã¡ã³ãã«åå²ãããã¹ãŠã®å¶æ°ãããã¯ãå±éããŸãã æ£èŠè¡šçŸåŠçãçµã¿èŸŒãŸããèšèªïŒPerlãªã©ïŒã§ã¯ããã®åé¡ã®è§£æ±ºçã¯äžè¬ã«ç¹ã«ã³ã³ãã¯ãã§èªç¶ã«èŠããŸãã
ãã·ã¢ã³ãŒãã«ããã§å©çšå¯èœãªãã¹ãŠã®ããã°ã©ãã³ã°èšèªã§ãã®åé¡ã®è§£æ±ºçãæäŸããŸãã åæã«ãæšæºã®å ¥åã¹ããªãŒã ããããŒã¿ãèªã¿åãæ¹æ³ã«æ³šæãæããŸããããå€ãã®åå è ããå ¥åããŒã¿ãååŸããå Žæã«ã€ããŠã®è³ªåãã³ã³ãã¹ãäžã«å°ããŸããã
æé©ãªãœãªã¥ãŒã·ã§ã³ã§ãããšã¯äž»åŒµããŠããŸãããéã®å Žåã§ããç°ãªãèšèªã§ãããã«ç°ãªããœãªã¥ãŒã·ã§ã³ãæäŸããããšããŸããã
JavaïŒ
import java.io.*; public class concat_as { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); String[] s = in.readLine().split("[()]"); for (int i = 0; i < s.length; i++) { if (i % 2 == 0) { System.out.print(s[i]); } else { System.out.print(new StringBuilder(s[i]).reverse()); } } } }
C ++ïŒ
#include <string> #include <iostream> #include <algorithm> using namespace std; int main () { string s; cin >> s; int l = 0; while (l < s.length()) { if (s[l] == '(') { int r = l; while (s[r] != ')') r++; string tmp = s.substr(l + 1, r - l - 1); reverse(tmp.begin(), tmp.end()); cout << tmp; l = r + 1; } else { cout << s[l]; l++; } } return 0; }
CïŒïŒ
using System; using System.Linq; class concat_as { static void Main(string[] args) { string s = Console.ReadLine(); int L, R; do { L = s.IndexOf("("); R = s.IndexOf(")"); if (L >= 0) { Console.Write(s.Substring(0, L)); Console.Write(new string( s.Substring(L + 1, R - L - 1).Reverse().ToArray())); s = s.Substring(R + 1); } } while (L >= 0); Console.WriteLine(s); } }
PerlïŒ
$s = <>; $s =~ s/\(([^)]*)\)/reverse($1)/eg; print $s
Python
s = raw_input() ans = '' for t in s.split('('): if ')' in t: l = t.split(')') ans += l[0][::-1] + l[1] else: ans += t print ans
Php
<?php $s = trim(fgets(STDIN)); $s = preg_replace('#\((\w+)\)#se', 'strrev("\1")', $s); echo "$s\n"; ?>
ãã®åé¡ã®è§£æ±ºçã¯ãPerlãšPHPã§ç¹ã«ã·ã³ãã«ã§ã³ã³ãã¯ãã§ããããšãå€æããããšã«æ³šæããŠãã ããã
ã¿ã¹ã¯B.é¢çš
çŸåšãã»ãšãã©ãã¹ãŠã®ã¢ãã€ã«ãªãã¬ãŒã¿ãŒã¯ãåå人ãèªåã«æãé©ãããã®ãéžæã§ããåºç¯ãªæéè¡šãæã£ãŠããŸãã æ®å¿µãªããããã®éžæãæåã§è¡ãããšã¯éåžžã«é£ããããšããããããŸãã
ã¢ãã€ã«ãªãã¬ãŒã¿ãŒã®1ã€ã§ã¯ãåæéã¯3ã€ã®æ°å€ã§ç¹åŸŽä»ããããŸãïŒãµãã¹ã¯ãªãã·ã§ã³æéciïŒã«ãŒãã«ã§èšå®ïŒãæå°è«æ±å¯èœæéåäœt i ïŒç§ã§èšå®ïŒãæå°è«æ±å¯èœæéåäœpiã®ã³ã¹ãïŒã³ããã¯ã§èšå®ã1ã«ãŒãã«ã§100ã³ããã¯ïŒã 1ãæãããã®é話ã®åèšã³ã¹ãã¯ãæé¡æéãšåçºä¿¡é話ã®ã³ã¹ãã§æ§æãããŸãã içªç®ã®æéã䜿çšããå Žåã®é話ã³ã¹ãã¯ã次ã®ããã«èšç®ãããŸããé話æéãTç§ãšããŸãã T <t iã®å Žåãé話ã³ã¹ãã¯ãŒãã§ãã ãã以å€ã®å Žåãã³ãŒã«ã³ã¹ãã¯kãšp iã®ç©ã«çãããªããŸããããã§ãkã¯kâ¢t iâ¥Tã®ãããªæå°æŽæ°ã§ãã
é¢çšã®èª¬æãšããã®æã®å å ¥è ã®çºä¿¡ã³ãŒã«ã®çµ±èšæ å ±ã瀺ãããŸã-ãã®æ°mãšæéd 1 ã...ãd mç§åäœã ãããã®é話ã®åèšã³ã¹ããæå°ã«ãªãé¢çšãèŠã€ããå¿ èŠããããŸãã
å ¥å圢åŒ
æåã®è¡ã«ã¯ããããã2ã€ã®æŽæ°nãšm-å å ¥è ã®æéãšçºä¿¡ã³ãŒã«ã®æ°ïŒ1â€nãmâ€100ïŒãå«ãŸããŠããŸãã 次ã®nè¡ã¯ãããã1ã€ã®é¢çšãè¡šãã3ã€ã®æŽæ°ãå«ã¿ãŸãïŒc i ïŒ0â€c iâ€100ïŒãt i ïŒ1â€t iâ€3600ïŒãpiïŒ0â€p iâ€1000ïŒã
æåŸã®è¡ã«ã¯ãmåã®æŽæ°d 1 ã...ãd m ïŒ1ããmãŸã§ã®ãã¹ãŠã®iã«å¯ŸããŠ1â€diâ€3600ïŒãå«ãŸããŠããŸãã
åºå圢åŒ
1ã€ã®çªå·ãå°å·ãã-é¢çšçªå·ã䜿çšããå Žåã該åœããæã®å å ¥è ã®çºä¿¡é話ã®åèšã³ã¹ãã¯æå°ã§ãã é¢çšã¯ãå ¥åãã¡ã€ã«ã§æå®ãããé åºã§1ãnã®æŽæ°ã§çªå·ä»ããããŸãã ãã®ãããªé¢çšãè€æ°ããå Žåã¯ããããã®ããããã®çªå·ãå°å·ããŸãã
解決ç
ãã®ã¿ã¹ã¯ã§ã¯ãæ¡ä»¶ãèªããšãã«åå è ã®æ³šæåããã¹ãããŸããã ãã®ã¿ã¹ã¯ã«ã¯ãäž»ã«2ã€ã®ã埮åŠãªããã€ã³ãããããŸãïŒãµãã¹ã¯ãªãã·ã§ã³æéã¯ã«ãŒãã«ã§èšå®ãããé話ã®ã³ã¹ãã¯ã³ããã¯ã§ãé話æéãåãäžããç¹æ§ïŒ1課éåäœæªæºã®äŒè©±ã¯ãŒãã«åãäžãããã1課éåäœãè¶ ããé話ã¯åãäžããããŸãã
ãããã®2ã€ã®ç¹ã«æ°ä»ããå Žåã解決çã¯ãæå®ãããåæéã§é話ã®ã³ã¹ãã®èšç®ãçŽæ¥å®è£ ããæé©ãªæéãéžæããããšã§ãã
åé¡C. KãœãŒã
䞊ã¹æ¿ãã®ã¿ã¹ã¯ã¯ãæå®ãããæ°å€ã®é åïŒãŸãã¯ä»ã®ãªããžã§ã¯ãïŒãæé ãŸãã¯éé ã«äžŠã¹ãããšã§ãã ãã®ã¿ã¹ã¯ã«ã¯ããªãã®æ°ã®ãªãã·ã§ã³ãããããã®å€ãã«ã¯éåžžã«å¹ççãªã¢ã«ãŽãªãºã ããããŸãã ãããã®ã¢ã«ãŽãªãºã ã®éèŠãªãã©ã¡ãŒã¿ãŒã®1ã€ã¯ãé åºä»ãã«å¿ èŠãªé åèŠçŽ ã®äº€æåæ°ã§ãã
次ã«ããœãŒããªãã·ã§ã³ãæ€èšããŸãããããkãœãŒããšåŒã³ãŸãã ãã®ãªãã·ã§ã³ã§ã¯ã1åã®æäœïŒk亀æãšåŒã°ããïŒã§ãé åã®2ã€ã®èŠçŽ ã®å€ããkã ãæ£ç¢ºã«ç°ãªãæ°å€ãšäº€æããããšãã§ããŸãã ããšãã°ãå ã®é åã®åœ¢åŒã[6ã10ã4ã1ã2]ã§ãk = 3ã®å Žåããã®é åã¯2ã€ã®æäœã§æé ã§ãœãŒãã§ããŸãïŒæåã®äº€æåŸãé åã®åœ¢åŒã¯[1ã10ã4ã6 ã2]ã2çªç®ä»¥é-[1ã2ã4ã6ã10]ïŒã
æŽæ°ã®é åa 1 ã...ãa nãäžããããŸãã ããªãã®ä»äºã¯ããã®é åãæžå°ããªãé åºã§äžŠã¹ãããã«å¿ èŠãªk亀æã®æå°æ°ã決å®ããããšã§ãã
å ¥å圢åŒ
æåã®è¡ã«ã¯æŽæ°nïŒ1â€nâ€300ïŒãå«ãŸããŠããŸãã 2è¡ç®ã«ã¯ãnåã®æŽæ°a1ã...ãanïŒ1ããnãŸã§ã®ãã¹ãŠã®iã«å¯ŸããŠ1â€aiâ€109ïŒãå«ãŸããŸãã 3è¡ç®ã«ã¯æŽæ°kïŒ1â€kâ€n-1ïŒãå«ãŸããŸãã
åºå圢åŒ
äžããããé åããèšè¿°ãããã¿ã€ãã®æäœã䜿çšããŠéæžå°é ã§é åºä»ããããå ŽåããœãŒãã«å¿ èŠãªk亀æã®æå°æ°ãåºåããŸãã ãã以å€ã®å Žåã¯ãåäžã®æ°å€-1ãåºåããŸãã
解決ç
kãæ³ãšããäœçœ®ã®æ®ãã«å¿ããŠãé åãkåã®éšåã«åå²ããŸãã ãããã®åéšåã§ã¯ãé£æ¥ããèŠçŽ ã¯kã®è·é¢ã«ãããããäºãã«äº€æã§ããŸãã é åã®ç°ãªãéšåã®èŠçŽ ã¯ãèŠçŽ éã§äº€æã§ããŸããã
ãœãŒããããé åã§ã¯ãåããŒãããœãŒããããããšã«æ³šæããŠãã ããã ãããã£ãŠãã¿ã¹ã¯ã¯æ¬¡ã®ããã«èŠçŽãããŸãããã¢ã¯ã·ã§ã³ã®æå°æ°ã®ããã«åéšåããœãŒãããçµæã®é åããœãŒããããŠããããšã確èªããŸãã ãããããªããçãã¯ããŒãããœãŒãããããã«å¿ èŠãªã¢ã¯ã·ã§ã³ã®ç·æ°ã§ãã é åãé åºä»ããããŠããªãå Žåã解決çã¯ãããŸããã
é£æ¥ããèŠçŽ ã®ã¿ã亀æããããšãèš±å¯ãããŠããå ŽåïŒã€ãŸããåéšåã䞊ã¹æ¿ããå¿ èŠãããæäœïŒãé åã䞊ã¹æ¿ããã®ã«å¿ èŠãªã¢ã¯ã·ã§ã³ã®æå°æ°ãç解ããå¿ èŠããããŸãã æå°éã®ã¢ã¯ã·ã§ã³æ°ã¯ãããã«ã«ããéåžžã®ãœãŒãã«ãã£ãŠå®è¡ãããããšãããããŸãã nã䞊ã¹æ¿ããé åa [0..n-1]ã®é·ããšããŸãã 次ã«ãç®çã®äº€æåæ°ã§æ¬¡ã®ã¢ã«ãŽãªãºã ãå®è¡ãããŸãã
for i from 0 to n â 1:
for j from 0 to n â 2:
if a[j] > a[j + 1]:
swap(a[j], a[j + 1])
ããã蚌æããŸãããïŒãã®ããã«ãå転ã®æ°ãšåŒã°ããé åã®æ¬¡ã®ç¹æ§ãèããŸãïŒäœçœ®ã®ãã¢ã®æ°ïŒiãjïŒ ã ãã㧠i < j ããã³a [i]> a [j] ã æããã«ããœãŒããããé åã§ã¯ãå転ã®æ°ã¯ãŒãã§ãã äžæ¹ã2ã€ã®é£æ¥ããèŠçŽ ã亀æãããšããã®ãããªãã¢ã®æ°ã1ã€ã ãå€æŽã§ããŸãã ãã®å Žåãå亀æã§ã®ããã«ã«ãããœãŒãã«ããããŠããããããã®å転æ°ãæžå°ããŸãã
ãããã£ãŠãããã«ã«ãã䞊ã¹æ¿ãã®äº€æã®æ°ã¯ãé åã®å転ã®æ°ãã€ãŸããé åã䞊ã¹æ¿ããããã«å®è¡ããå¿ èŠã®ãã亀æã®æå°æ°ã«çãããªããŸãã
åé¡D.ã¬ãŒã«
ééã®éèŠãªãã©ã¡ãŒã¿ãŒã¯ãã©ãã¯ã²ãŒãžã§ããããã¯ãåè»ã移åãã2æ¬ã®ã¬ãŒã«éã®è·é¢ã§ãã ééã§ç§»åã§ããåè»ããã®ä»ã®è»ã®çš®é¡ã決å®ããã®ã¯ããã®ãã©ã¡ãŒã¿ãŒã§ãã
æè¿ãææRCC-0805ãžã®å®å®é åŸã§ããã®ææã«ééãããããšãããããŸããã ééããããçºèŠãããŸããããã²ãŒãžã決å®ããããšã¯ãŸã ã§ããŸããã§ããã å®éããã®ææã®ééã¯ææšãªãã§æ·èšãããŠãããããã©ã®ééãäºãã«å¯Ÿå¿ããŠããããå€æããã®ã¯å¿ ããã容æã§ã¯ãããŸããã
ééè»äž¡åºå°ã®é åã«ãããã¬ãŒã«ã®äœçœ®ã®èšç»ãäžããããŸãã ç°¡åã«ããããã«ãããªããªãŒã¯ç¡éå¹³é¢ã§ãããåã¬ãŒã«ã¯çŽç·ãšããŠè¡šç€ºããããšæ³å®ããŠããŸãã ã¬ãŒã«ããã¢ã«åå²ã§ããæå°ã²ãŒãždãèŠã€ããŠãåãã¢ã§ã¬ãŒã«ãå¹³è¡ã«ãªãããããã®éã®è·é¢ãdã«çãããªãããã«ããå¿ èŠããããŸãã
å ¥å圢åŒ
æåã®è¡ã«ã¯æŽæ°nïŒ1â€nâ€2000ïŒãå«ãŸããŠããŸãã 次ã®2nè¡ã«ã¯ããããã4ã€ã®æŽæ°x iã1ã y iã1ã x iã2ã y iã2ãå«ãŸããŠããŸããããã¯ãã¬ãŒã«ãééãã2ã€ã®ç°ãªããã€ã³ãã®åº§æšã§ãã ãã¹ãŠã®åº§æšã®çµ¶å¯Ÿå€ã¯1000ãè¶ ããŸããã ç°ãªãã¬ãŒã«ã«å¯Ÿå¿ããçŽç·ã¯äžèŽããŸããã
åºå圢åŒ
å®æ°-å¯èœãªéãæå°ã®ã²ãŒãžãå°å·ããŸãã 10 -6以äžã®ç²ŸåºŠã§æ±ºå®ããå¿ èŠããããŸãã
ä»»æã®ã²ãŒãžã§ã¬ãŒã«ããã¢ã«åå²ããããšãäžå¯èœãªå Žåãã¿ã¹ã¯ã®èŠä»¶ãæºããããšãäžå¯èœãªå Žåãæ°å€-1ãå°å·ããŸãã
解決çã
ãŸããã¬ãŒã«ãç·ã®æ¹åã«ç䟡ã¯ã©ã¹ã«åå²ããŸããå¹³è¡ç·ã¯1ã€ã®ã¯ã©ã¹ã«åé¡ãããŸãã ãã®åŸãåã¯ã©ã¹ã§ããã®ã¯ã©ã¹ã®ãã¹ãŠã®å¯èœãªã²ãŒãžå€ãèŠã€ããŸãã çãã¯å¯èœãªéãæå°ã®è·é¢ã§ããããã¹ãŠã®ã¯ã©ã¹ã«é©ããŠããŸãã
次ã«ããœãªã¥ãŒã·ã§ã³ã®å段éã詳现ã«æ€èšããŸãã
ç䟡ã¯ã©ã¹ã«ãã£ãŠç·ãååžãããããã«ãåç·ã®æ¹çšåŒãäœæããŸãã ç·ãç¹ïŒx 1 ãy 1 ïŒãïŒx 2 ãy 2 ïŒãééããããã«ããŸãã ãã®å Žåãax + by + c = 0ãšãã圢åŒã®æ¹çšåŒã¯ãa = y 1 -y 2 ãb = x 2 -x 1 ãc =-ïŒax 1 + by 1 ïŒã®ããã«ãªããŸãã ããã§ãaãbãããã³cãé€ç®ããããšã«ãããç·ã®ä¿æ°ãæ£èŠåãããšäŸ¿å©ã§ã ã çŸåšãåè¡ã«ã¯2ã€ã®è¡šçŸããããŸãïŒä¿æ°ã«â1ãæãããŸã§ã åè¡ã«åäžã®æ¹çšåŒãæãããã«ã¯ããa> 0 orïŒa = 0 and b> 0ïŒããšããæ¡ä»¶ãè¿œå ã§èŠæ±ãããšäŸ¿å©ã§ãã ãã®èŠä»¶ãæºãããããšãå¹³è¡ç·ã®ãã¢ã¯åãã«ãªããŸãïŒaãbïŒã ãã®è¡šçŸã§ã¯ãç·éã®è·é¢ãèšç®ããããšã䟿å©ã§ãã2æ¬ã®å¹³è¡ç·ax + by + c 1 = 0ããã³ax + by + c 2 = 0ã®å Žåãè·é¢ã¯| c 1 -c 2 |ã§ãã
å¹³è¡ç·ã®ã¯ã©ã¹ãæ€èšããŠãã ããã ããããä¿æ°cã§ãœãŒãããŸãã æåã®è¡ãæ€èšããŠãã ãã-ãã®ã¯ã©ã¹ã®ä»ã®è¡ã®1ã€ãšãã¢ã«ãªã£ãŠããŸãã ãã®è¡ã調ã¹ãŸãã ãããã®éã®è·é¢ãdãšçããããŸãã ããã§ãè·é¢dã«ãããã¢ã«ç·ã®ããŒãã£ã·ã§ã³ãç±å¿ã«æ§ç¯ããŸãã ãããå®è¡ã§ããå Žåãdã¯ç¹å®ã®ã¯ã©ã¹ã®ãã©ãã¯å¹ ã«ãªããŸãã è¡ãæé ã§æ€èšããŸãcã 次ã®çŽç·c = c iã«ãŸã ãã¢ããªãå Žåãc = c i + dã®è·é¢dã§å¹³è¡ã«ãªããŸãã ãã®ãããªè¡ãããå Žåãåé¡ã®è¡ãšã«ããã«ã§çµåããŸãã ãã¢ãªã³ã°ã¯ã2ãã€ã³ã¿ãŒæ¹åŒã䜿çšããŠç·åœ¢æéã§å®çŸã§ããŸããcã®å¢å ãšãšãã«c + dãå¢å ããããšã«æ°ä»ãã®ã«ååã§ãã
æåŸã«ãçããæ¢ãããšãæ€èšããŠãã ãããåã¯ã©ã¹ã«å¯èœãªçãã®ãªã¹ãããããŸãã åœç¶ããããã¯æé ã§ãœãŒããããŸãã ãã®ãããª2ã€ã®ãªã¹ãã¯ã1ã€ã®ãã¹ã§ç°¡åã«ã¯ãã¹ã§ããŸãã ãªã¹ãã®é·ãã®åèšã«æ¯äŸããæéã§ãã¹ãŠã®ãªã¹ãã®å ±ééšåãå®äºãããšãæå°èŠçŽ ãåé¡ã«å¯Ÿããçãã§ããå ±ééšåãªã¹ããåŸãããŸãã
ã¢ã«ãŽãªãºã ã®å®è¡æéãåæããŸãããã åé¡ã¯OïŒnïŒã§å®è¡ãããŸãã ãµã€ãºkã®ç¹å®ã®ã¯ã©ã¹ã«ã€ããŠã蚱容è·é¢ã®ãªã¹ãã¯OïŒk 2 ïŒã§æ§ç¯ããããã®é·ãã¯kãè¶ ããŸããã ãããã£ãŠãæåŸã®ã¹ãããã¯OïŒnïŒã§å®è¡ãããã¢ã«ãŽãªãºã å šäœã¯OïŒn 2 ïŒã§å®è¡ãããŸãã
åé¡E.æ°åãæšæž¬ãã
æè¿ã人æ°ã®ãããœãŒã·ã£ã«ãããã¯ãŒã¯ã®1ã€ã«ãã¢ããªã±ãŒã·ã§ã³ãGuess the NumberïŒããç»å ŽããŸããã ãŠãŒã¶ãŒã«ã¯ã²ãŒã ãæäŸãããŸããã²ãŒã ã®åã¬ãã«ã§ã¯ãã²ãŒã ã«é¢ããããã€ãã®æ å ±ããé ãçªå·ã決å®ããå¿ èŠããããŸãã
ç¹ã«ãæãé£ããã¬ãã«ã®1ã€ã§ã¯ãæçæ°xïŒ0 <x <1ïŒãæšæž¬ããå¿ èŠããããŸããããã¯ã10é²è¡šèšã§èªç¶æ°kãä¹ç®ããçµæãæ£ç¢ºã«1ã€ã®å€æŽãçºçããããšãããã£ãŠããŸããå°æ°ç¹ã®åŸã®jçªç®ã®æ°åïŒæ°åã¯å·Šããå³ã®æ¹åã«1ããçªå·ãä»ããããŸãïŒã ãã®å Žåãå°æ°ç¹ãŸã§ã®æ¡ã¯å€æŽãããŠããŸãããã€ãŸããäžçåŒ0 <k x <1ãæºããããŸããæåã«å°æ°ç¹xã§å°æ°ç¹ä»¥äžã®æ¡æ°ãç¡éã«ã§ããããšã«æ³šæããŠãã ããã
ããªãã®ä»äºã¯ãæ°å€iãjãkã«ãã£ãŠxã®å€ã決å®ããããã°ã©ã ãäœæããããšã§ãã
å ¥å圢åŒ
æåã®è¡ã«ã¯ã3ã€ã®æŽæ°iãjãkãå«ãŸããŠããŸãïŒ1â€i <jâ€1000; 2â€kâ€109ïŒã
åºå圢åŒ
ç®çã®æ°ãååšããå Žåã¯ã2ã€ã®æŽæ°ãå°å·ããŸã-ç®çã®æ°ãå®çŸ©ããæ¢çŽåæ°ã®ååaãšåæ¯bïŒaãb> 0ïŒã ãã以å€ã®å Žåã¯ããã¬ãŒãºNO SOLUTIONãåºåããŸãã
解決ç
æåã«å³sãiçªç®ã®äœçœ®ã«ãããå³tãjçªç®ã®äœçœ®ã«ãããšããŸãã 次ã«ãkãä¹ç®ããåŸã®æ°ã¯ãx-10 âi s + 10 âi t-10 âi t + 10 âi sã§ãã ãããã£ãŠãæãŸããæ°ã¯ãåŒkx = x-10 -i s + 10 -i t-10 -i t + 10 -i sã®è§£ã§ãã
å®éã解ã¯sãštã®ç¹å®ã®å€ã«äŸåããã®ã§ã¯ãªãããããã®å·®ã«ã®ã¿äŸåããããšã«æ³šæããŠãã ããïŒïŒk-1ïŒx =ïŒ10 âi -10 âi ïŒïŒt-sïŒã ããã«ãs <tã ãããã£ãŠã1ã9ã®ç¯å²ã§å·®ïŒt-sïŒãæŽçããã ãã§ååã§ããããããã®å·®ã®å€ã«ã€ããŠãæ¹çšåŒã®è§£ãèŠã€ããŠç¢ºèªããŸããæŽæ°éšåã¯ãŒãã®ãŸãŸã§ãã
転éã«ãããäžèšã®æ¹çšåŒã®è§£ãåé¡ã®è§£ã«å¯Ÿå¿ããªãå¯èœæ§ããããããæ€èšŒãå¿ èŠã§ãã
ãããã質åãšåç
競æäžãåå è ã¯å¯©å¡ã«è³ªåãéãããšãã§ããŸããã ããã€ãã®è³ªåã«ç¹ã«é »ç¹ã«åºäŒã£ãããããã®èšäºã§ã¯ãããã«çããããšã«ããŸããã
質åïŒæ€èšŒã®ããã«ãœãŒã¹ã³ãŒããŸãã¯ã³ã³ãã€ã«æžã¿ãã¡ã€ã«ãéä¿¡ããå¿ èŠããããŸããïŒ
åçïŒæ€èšŒã®ããã«ãœãŒã¹ã³ãŒããéä¿¡ããå¿ èŠããããŸãã ãã¹ãã·ã¹ãã èªäœãåå è ã®æ±ºå®ãã³ã³ãã€ã«ããã³ãã³ãã©ã€ã³ã¯ãã·ã¢ã³ãŒãã«ããã®ã«ãŒã«ã§æå®ãããŸã
質åïŒããŒã¿ã®å ¥åå ã¯ã©ãã§ããïŒ
åçïŒããããæšæºå ¥åã¹ããªãŒã ããããŒã¿ãå ¥åããå¿ èŠããããŸãã ããã¯ããŒããŒãå ¥åã«å¯Ÿå¿ããŸããè¿œå ã®ãã©ã¡ãŒã¿ãŒãªãã§æšæºå ¥åã¹ããªãŒã ããããŒã¿ãèªã¿åãããã°ã©ã ãå®è¡ãããšãããŒããŒãããå ¥åãå®è¡ãããŸãã
åæã«ãããŒã¹ãããŒã¯ã®åæããããŒã¹ãããŒã¯ã«é¢ãããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã¡ãã»ãŒãžã®åä¿¡ãªã©ãäœã¬ãã«ã®ããŒããŒãå ¥åã¯ééã£ãã¢ãããŒãã§ãã èªã¿åãã¯ãã³ã³ãœãŒã«ãããã§ããå¿ èŠããããŸãã
質åïŒçãã¯ã©ãã«å ¥åããã°ããã§ããïŒ
åçã¯æšæºåºåã¹ããªãŒã ã«åºåããå¿ èŠããããŸãïŒããã©ã«ãã§ã¯ãç»é¢ã«éä¿¡ãããŸãïŒã ç¹°ãè¿ããŸãããäœã¬ãã«ã®ããŒã«ã§ãããå®è¡ããããšããªãã§ãã ããã
次ã«ããã·ã¢èªã³ãŒãã«ããã§ãµããŒããããŠãããã¹ãŠã®ããã°ã©ãã³ã°èšèªã§æšæºå ¥åã¹ããªãŒã ãèªã¿åããæšæºåºåã¹ããªãŒã ã«æžã蟌ãäŸã瀺ããŸãã
Java
å ¥åã«ã¯ãSystem.inã¹ããªãŒã ã䜿çšããŸãã Javaã§å ¥åã解æããããã®æã䟿å©ãªæ段ã¯ãBufferedReaderã¯ã©ã¹ãšScannerã¯ã©ã¹ã§ãã BufferedReaderã¯èªã¿åããéãã倧éã®ããŒã¿ã1è¡ãã€ãã°ããèªã¿åãããšãã§ããŸãã ã¹ãã£ããŒã¯æ£èŠè¡šçŸã䜿çšããŠããããäœéã§ãããããšãã°å ¥åãã1ã€ã®æ°å€ãèªã¿åããªã©ãå ¥åæååãéåžžã«æè»ã«è§£æã§ããŸãã
BufferedReaderã䜿çšããŠæšæºå ¥åã¹ããªãŒã ããèªã¿åãã«ã¯ãããã°ã©ã ã«æ¬¡ã®è¡ãèšè¿°ããŸãã
BufferedReader in =æ°ããBufferedReaderïŒæ°ããInputStreamReaderïŒSystem.inïŒïŒ;
Scannerã䜿çšããŠæšæºå ¥åã¹ããªãŒã ããèªã¿åãã«ã¯ãããã°ã©ã ã«æ¬¡ã®è¡ãèšè¿°ããŸãã
ã¹ãã£ããŒå ¥å=æ°ããã¹ãã£ããŒïŒSystem.inïŒ;
åºåã«ã¯ãSystem.outã䜿çšããŸãã åæã«ãSystem.outã¯ãã£ãã·ã¥ãããŸããïŒããã«ãããã¡ãŒããã©ãã·ã¥ããŸãïŒã倧éã®æ å ±ã衚瀺ããå¿ èŠãããå Žåã¯ãPrintWriterã§ã©ããããããšããå§ãããŸãã
C ++
scanfã䜿çšããŠãã¯ã©ã·ãã¯Cãå ¥åã§ããŸãã ãã®é¢æ°ã¯ãæšæºå ¥åã¹ããªãŒã ããããŒã¿ãèªã¿åããŸãã
ã¹ããªãŒã ãä»ããå ¥åã¯ãcinã¹ããªãŒã ã䜿çšããŠè¡ãããŸãã ããã©ã«ãã§ã¯ãæšæºå ¥åã¹ããªãŒã çšã«æ§æãããŠããŸãã ã¹ããªãŒã ã䜿çšããå ¥åã¯ãscanfã䜿çšããå ¥åãããå€§å¹ ã«é ããããããã°ã©ã ã倧éã®ããŒã¿ãèªã¿åãæéããªãå Žåãããããšã«æ³šæããŠãã ããã
åºåã«ã€ããŠããåŸæ¥ã®printfãŸãã¯ã¹ããªãŒãã³ã°coutã䜿çšã§ããŸãã ãã¹ãŠã®ããã©ãŒãã³ã¹ããŒãã¯æå¹ãªãŸãŸã§ãããprintfã¯ããé«éã§ãã
CïŒ
å ¥åã«ã¯ã³ã³ãœãŒã«ã䜿çšããŸãã Console.ReadLineïŒïŒã¯ãå ¥åã®æ¬¡ã®è¡ãèªã¿åããŸãã 解æããã«ã¯ãsplitïŒïŒã¡ãœããã䜿çšããŸãã ããŒã¿ãæ°å€ã«å€æããã«ã¯ãConvertã¯ã©ã¹ã䜿çšããŸãã
ã³ã³ãœãŒã«ãåºåã«äœ¿çšããå¿ èŠããããŸãã ããšãã°ãæ°å€xãåºåããã«ã¯ãConsole.WriteLineïŒxïŒãèšè¿°ã§ããŸãã
Python
å ¥åã«ã¯ãinputãŸãã¯raw_inputé¢æ°ã䜿çšã§ããŸãã æšæºå ¥åçšã«æ§æãããsys.stdinãã¡ã€ã«èšè¿°åã䜿çšããããšãã§ããŸãã
åºåã«ã¯printã䜿çšããããšããå§ãããŸãã
Perl
Perlã®æšæºå ¥åããã®å ¥åã¯ã<>ã³ãã³ãã䜿çšããŠè¡ãããŸãã ãã®ã³ãã³ãã¯ããã¡ã€ã«ããè¡ãèªã¿åãããããè¿ããŸãã
åºåã«ã¯printã䜿çšããããšããå§ãããŸãã
Php
PHPã®æšæºå ¥åããã®å ¥åã¯ãSTDINèšè¿°åããè¡ãããŸãã 次ã®è¡ã¯ãããšãã°ãfgetsã³ãã³ãã§èæ ®ããããšãã§ããŸãã
åºåã«ã¯ãprintãŸãã¯echoã䜿çšã§ããŸãã
ããŸããŸãªè¡èªã¿èŸŒã¿é¢æ°ã䜿çšããå Žåãããã¥ã¡ã³ãã泚ææ·±ãèªã¿ãé¢æ°ãè¡ãšãšãã«æ¹è¡ãè¿ããã©ããã«æ³šæããããšããå§ãããŸãã 審æ»å¡ã®ãã¹ãã§ã¯ãæåŸãå«ããã¹ãŠã®è¡ãæ¹è¡ã§çµããããã¹ãã¯Windows 7ã§è¡ãããWindowsã§åãå ¥ããããçµã¿åããã¯ãã³ãŒã13ãš10ã®æåã§æ§æãããè¡ãã£ãŒãã«äœ¿çšãããŸãã
ããã«ããã¹ãã¯èªåçã«è¡ãããããšã«æ³šæããŠãã ããã ãããã£ãŠãããŸããŸãªãå ¥åããã³ããããåºåããããçµè«ããè£ é£Ÿãããããšãããããªãã§ãã ããã ããŒã¿ãå ¥åããåé¡ã解決ããåºå圢åŒã«åŸã£ãŠããŒã¿ã衚瀺ããå¿ èŠããããŸãã
質åïŒäŸã®ãã¹ãã¯æ£ããã§ããïŒ
åçïŒãã®äŸã®ãã¹ãã¯éåžžââæ£ããã§ã-äºåã«ç¥ããã«åé¡ã解決ããæ°äººãå«ãæ°äººããã§ãã¯ããŸãã ãã¹ãäŸãæ£ãããªããšæãããå Žåã¯ãæ¡ä»¶ããã泚ææ·±ãèªãã§ãã ãããããããäœãã誀解ããŠããå¯èœæ§ããããŸãã
ããã§ãäŸãééã£ãŠãããšæãå Žåã¯ãäŸã«èª€ãããããšèããçç±ãã©ã®çããæ£ããããäžæ£ç¢ºãŸãã¯ææ§ã ãšæããã®ã®è©³çŽ°ãªèª¬æããªã¯ãšã¹ãã«å«ããŠãã ããã
質åïŒåé¡Xã®239çªç®ã®ãã¹ãã¯æ£ããã§ããïŒ
åçïŒã»ãšãã©ã®å Žåããã¹ãã¯æ£ããã§ãã ãã¹ããééã£ãŠãããšæãå Žåã¯ããã®çç±ãæžããŠãã ããã ããã®ãããªãã¹ãã¯æ£ãããã¹ãã§ããïŒããšãã質åãããã®ã¯ç¡æå³ã§ãã - «» - , .
: , ?
: , .
!
Russian Code Cup