This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
【解答】 | |
・第1問:2.01966 | |
・第2問:3.10849098132 | |
【方針】 | |
(回答時コメント) | |
良い方法が思いつかなかったので、苦し紛れのDPでの数え上げです。 | |
0から9の10文字の個数をそれぞれA[0],A[1],A[2],…,A[9]とすると、 | |
今回、n<=12なので、各A[i]は精々4bitで表されることから、64bit整数Sを用いて S=ΣA[i]<<4*i for i=0 to 9 で | |
出目の状態をエンコードできます。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN{s="あアぃィいイぅゥうウぇェえエぉォおオかカがガきキぎギくクぐグけケげゲこコごゴさサざザしシじジすスずズせセ";for(i=0;i<26;f(i++));}function f(i){a=97+i;b=65+i;c=substr(s,2*i+1,1);d=substr(s,2*i+2,1);printf("%c%c%s%s%c%c",a,b,c d,d c,b,a)} | |
# | |
#(注)以下を1行にまとめただけ | |
# 変数のスコープは引数以外はグローバル変数なので、function f(i)から メインのsを参照している汚いコード。 | |
# | |
#BEGIN{ | |
# s="あアぃィいイぅゥうウぇェえエぉォおオかカがガきキぎギくクぐグけケげゲこコごゴさサざザしシじジすスずズせセ"; | |
# for(i=0;i<26;f(i++)); | |
#} | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
class TEST{ | |
static void Main(){ | |
Sol mySol =new Sol();//コンストラクタ データ読み取り | |
mySol.Solve(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN{for(;f<58;)printf("%c",65+f++)} | |
#number of char 37 | |
#kinds of char 26 | |
#Point 962 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
END{while(++k<9)for(j=0;117>d=36+2*k*j++;)printf"%c",d} | |
# | |
#number of char 55 | |
#number of multi count 17 | |
#Point 990 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
class TEST{ | |
static void Main(){ | |
Sol mySol =new Sol(); | |
int N=1000; | |
mySol.Solve(N); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Collections; | |
using System.Collections.Generic; | |
class TEST{ | |
static void Main(){ | |
//String InputFile="./data.txt"; | |
//StreamReader SR=new StreamReader(InputFile); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
class TEST{ | |
static void Main(){ | |
long N=7777777; | |
long ans=3; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
END{for(;i<50;)printf++i%5?i%3?i:"fizz":i%3?"buzz":"FIZZBUZZ"} | |
# gawk:62文字 | |
# ポイント | |
# ・++iのおかげでprintfが'('無しでparseできる。 | |
# ・awkの変数は文字列と数値両方の型を持つので、3項演算子の引数の iは | |
# 文字列とみなしてparseしてくれている。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Collections; | |
using System.Collections.Generic; | |
class TEST{ | |
static void Main(){ | |
String inputFile="./data.txt"; | |
StreamReader sr=new StreamReader(inputFile); |
OlderNewer