タグ付けされた質問 「classification」

この課題では、データのプロパティに基づいて、入力データに特定のクラスでラベルを付ける必要があります。

1
人にやさしいファイル名の検出
前書き ファイル名は乱暴に単純なものから至るまで、物事を変えることが可能blah.txtに303549020150514101638190-MSP0.txt。前者は通常人間が生成し、後者はしばしば機械で生成されます。ファイルが「人にやさしい」と見なされるかどうかについて、知識に基づいた推測を行う単純な関数があればいいのではないでしょうか。 削除されたEduard Florinescuの投稿に触発されました。彼のアイデアは良かったが、少し肉付けする必要があった。 チャレンジ 文字列を取得できる任意の言語でプログラムまたは関数を記述し、この課題で定義されているように、「人間に優しい」と見なされるかどうかを判断します。 その他の詳細とルールは次のとおりです。 入力は、95の印刷可能なASCII文字で構成される文字列になります。 「人に優しい」とはこのように定義されるものとする: 考慮事項から拡張子を除外します。拡張子は、最後のピリオドの後に一連の英数字(最低1、最大6)が続くものとして定義されます。 文字列の長さの半分(拡張子を除く)は、以下の定義された文字のグループ(結合)で構成できます。 8桁を超える10進文字。 16文字以上の16進文字(大文字または小文字)(文字と数字で構成され、文字の3分の1以上が数字である必要があります)。 %+=続けて12文字以上のBase64文字(特殊文字として使用)(文字と数字で構成され、大文字と小文字が混在し、文字の3分の1以上が大文字である必要があります)。 上記のグループのいずれかが定義で重複している場合(base64として認定されているが、8桁が連続しているグループなど)、除外する最も長いグループを選択します。 文字列が「人にやさしい」と見なされるかどうかに応じて、出力は真実または偽の値である必要があります。 有効な入力のみが使用されると仮定します。エラー処理について心配する必要はありません。 勝者は最短のプログラム/機能によって決定されます。少なくとも7日以内に、または十分な数の提出があった場合に、選考されます。引き分けの場合、先に来た答えが優先されます。 例 以下に、コードで処理できる入力と出力の例をいくつか示します。 "results_for__michael_greer.txt.zip" => true "Georg Feuerstein - Connecting the Dots.pdf" => true "M People - Search for the Hero-ntuqTuc6HxM.mp4" => true "index.html?v=QTR4WGVTUzFsV3d8NHxvcmlnaW5hbHx8MTExMTAxBHxodHRwOi8vLCwsLHRyLDcsMA%3D%3D.html" => false "ol2DCE0SIyQC(173).pdf" => false "d41d8cd98f00b204e9800998ecf8427e.md5" => false "12792331_807918856008495_7076645197310150318_o.jpg" …

7
pseudoprimesをゴルフしましょう!
はじめに/背景 で、最近の議論で暗号チャット私は議論するために/のヘルプ挑戦されたフェルマー素数判定テストとカーマイケル数を。このテストは、a^(p-1) mod p==1常に素数に当てはまるがp、常にコンポジットには当てはまらないという前提に基づいています。カーマイケル番号は、基本的にはフェルマートのテストで最悪の敵です。取得するために同時に素数にならないように選択aする必要がある番号です。が共素数でない場合、本質的には、自明ではない因子を見つけましたpa^(p-1) mod p!=1apそして、誰もが知っているように、因数分解は非常に難しい場合があります。特に、すべての要素が十分に大きい場合。これで、Fermatテストが実際にはあまり使用されない理由がよくわかります(より優れたアルゴリズムがあります)。これは、(セキュリティの観点から)防御者としてのあなたが同じような量の作業を行わなければならない数があるためです。攻撃者(つまり、数を因数分解します)。 これらの数値が魅力的である理由がわかったので、可能な限り最短の方法で数値を生成します。必要に応じて、生成したコードを記憶することができます。 カーマイケル番号は、OEISではA002997としても知られています。関連する課題はすでに ありますが、サイズではなく速度が最適化されているため、ここからのエントリは競争力がありません。同じ議論が逆の方向にも当てはまり、ここのエントリはサイズを優先して速度とトレードオフをする可能性があります。 仕様 入力 これは標準のシーケンスチャレンジなので、正または負でない整数nを入力として使用します。n必要に応じて、0または1のインデックスを付けることができます(指定してください)。 出力 出力は、必要にn応じて、-番目のカーマイケル番号または最初のnカーマイケル番号のいずれかになります(指示してください)。 仕様 整数xは、xが複合である場合にのみカーマイケル数であり、のすべての整数yについてgcd(x,y)=1、それを保持しy^(x-1) mod x==1ます。 誰が勝ちますか? これはcode-golfなので、バイトで最短のコードが優先されます!標準のIOと抜け穴のルールが適用されます。 テストケース 最初のいくつかのカーマイケル番号は次のとおりです。 561,1105,1729,2465,2821,6601,8911,10585,15841, 29341,41041,46657,52633,62745,63973,75361,101101, 115921,126217,162401,172081,188461,252601,278545, 294409,314821,334153,340561,399001,410041,449065, 488881,512461
9 code-golf  math  sequence  number-theory  primes  code-golf  string  code-golf  math  combinatorics  permutations  restricted-complexity  code-golf  array-manipulation  code-golf  number  sequence  code-golf  number  sequence  code-golf  binary-matrix  code-golf  math  tips  javascript  algorithm  code-golf  string  code-golf  number  sequence  code-golf  math  arithmetic  parsing  code-golf  number  sequence  primes  code-golf  string  ascii-art  geometry  integer  code-golf  geometry  code-golf  number  array-manipulation  code-golf  math  geometry  code-golf  number  sequence  arithmetic  integer  code-golf  string  kolmogorov-complexity  code-golf  number  code-golf  number  chess  code-golf  sequence  decision-problem  subsequence  code-golf  math  number  primes  code-golf  primes  permutations  code-golf  integer  probability-theory  statistics  code-golf  string  code-golf  sequence  decision-problem  parsing  board-game  code-golf  binary  graph-theory  code-golf  board-game  classification  tic-tac-toe  code-golf  ascii-art  polyglot  code-golf  date  code-golf  geometry 

13
比較チェーンを拡張
ほとんどの言語と異なり、Python a<b<cは数学で行われるように評価し、ブール値a<bをと比較するのではなく、実際には3つの数値を比較しcます。これをC(および他の多くの)で記述する正しい方法は、a<b && b<c。 この課題の課題は、このような任意の長さの比較チェーンをPython /直感的な表現から他の言語でどのように記述するかまで拡張することです。 仕様書 プログラムは演算子を処理する必要があります。 ==, !=, <, >, <=, >=。 入力には、整数のみを使用した比較チェーンがあります。 途中の比較の真実性について心配する必要はありません。これは、純粋に構文解析/構文上の課題です。 入力には、スペースで分割することで解析を簡単にする回答を防ぐための空白はありません。 ただし、出力には、&&' のみ、または比較演算子と&&'の両方のいずれか、または両方を囲む単一のスペースがある場合がありますが、一貫性があります。 テストケース Input Output --------------------------------------------------------------- 3<4<5 3<4 && 4<5 3<4<5<6<7<8<9 3<4 && 4<5 && 5<6 && 6<7 && 7<8 && 8<9 3<5==6<19 3<5 && 5==6 && 6<19 10>=5<7!=20 10>=5 && 5<7 && …
9 code-golf  parsing  conversion  syntax  code-golf  sequence  primes  code-challenge  geometry  optimization  code-golf  graph-theory  code-golf  number-theory  primes  integer  code-golf  source-layout  cops-and-robbers  code-golf  source-layout  cops-and-robbers  code-golf  sequence  primes  integer  code-golf  math  number-theory  primes  rational-numbers  code-golf  math  sequence  number-theory  primes  code-golf  string  code-golf  math  combinatorics  permutations  restricted-complexity  code-golf  array-manipulation  code-golf  number  sequence  code-golf  number  sequence  code-golf  binary-matrix  code-golf  math  tips  javascript  algorithm  code-golf  string  code-golf  number  sequence  code-golf  math  arithmetic  parsing  code-golf  number  sequence  primes  code-golf  string  ascii-art  geometry  integer  code-golf  geometry  code-golf  number  array-manipulation  code-golf  math  geometry  code-golf  number  sequence  arithmetic  integer  code-golf  string  kolmogorov-complexity  code-golf  number  code-golf  number  chess  code-golf  sequence  decision-problem  subsequence  code-golf  math  number  primes  code-golf  primes  permutations  code-golf  integer  probability-theory  statistics  code-golf  string  code-golf  sequence  decision-problem  parsing  board-game  code-golf  binary  graph-theory  code-golf  board-game  classification  tic-tac-toe  code-golf  ascii-art  polyglot  code-golf  date  code-golf  geometry 

30
int入力nを指定して、n * reversed(n)を出力します
整数nを指定して出力n * reversed(n) reversed(n)は、reverseの桁を取得したときに取得する数値ですn。 reverse(512) = 215 reverse(1) = 1 reverse(101) = 101 >>>>>>>> func(5) = 5*5 = 25 func(12) = 12*21 = 252 func(11) = 11*11 = 121 func(659) = 659*956 = 630004 最短のコードが勝ちます! リーダーボード コードスニペットを表示 var QUESTION_ID=144816,OVERRIDE_USER=71625;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var …
9 code-golf  math  arithmetic  code-golf  math  integer  code-golf  arithmetic  integer  code-golf  sequence  base-conversion  palindrome  code-golf  math  primes  integer  code-golf  parsing  conversion  syntax  code-golf  sequence  primes  code-challenge  geometry  optimization  code-golf  graph-theory  code-golf  number-theory  primes  integer  code-golf  source-layout  cops-and-robbers  code-golf  source-layout  cops-and-robbers  code-golf  sequence  primes  integer  code-golf  math  number-theory  primes  rational-numbers  code-golf  math  sequence  number-theory  primes  code-golf  string  code-golf  math  combinatorics  permutations  restricted-complexity  code-golf  array-manipulation  code-golf  number  sequence  code-golf  number  sequence  code-golf  binary-matrix  code-golf  math  tips  javascript  algorithm  code-golf  string  code-golf  number  sequence  code-golf  math  arithmetic  parsing  code-golf  number  sequence  primes  code-golf  string  ascii-art  geometry  integer  code-golf  geometry  code-golf  number  array-manipulation  code-golf  math  geometry  code-golf  number  sequence  arithmetic  integer  code-golf  string  kolmogorov-complexity  code-golf  number  code-golf  number  chess  code-golf  sequence  decision-problem  subsequence  code-golf  math  number  primes  code-golf  primes  permutations  code-golf  integer  probability-theory  statistics  code-golf  string  code-golf  sequence  decision-problem  parsing  board-game  code-golf  binary  graph-theory  code-golf  board-game  classification  tic-tac-toe  code-golf  ascii-art  polyglot  code-golf  date  code-golf  geometry 

9
シャンテダンスマッチング
で元Shantaeゲーム、変換を使用して、踊りながら、所定のシーケンスを完了する場合は、対応する形式に変換(またはテレポートまたは治癒)であろうD-パッド、A、及びBを使用して時間内に入力し、使用していることが踊りれます。あなたの仕事は、入力が与えられたときに対応する効果を出力することです。キャッチは、入力の前後で無関係なダンスの動きが発生する可能性があり、入力にダンスさえない場合があることです。 ダンス UDLRABダンスの動きに使用: モンキー: DR 象: DL クモ: DA ハーピー: DB Tinkerbat: DUU 治癒: DUA スカットルタウン: DULR ウォータータウン: DURLAB オアシスタウン: DURRBA ゾンビキャラバン: DULLBA バンディットタウン: DUBLBR コーディング 入力:一連のダンスの動き。これには、上、下、左、右、B、A、および待機の値を含めることができます。便利なエンコーディングを使用します。 出力:シーケンスで最初に一致するダンスに対応する値、または一致しない場合は異なる値。これは便利な方法でエンコードできます。 例 .待機に使用: DR →サル UUU.DLUAB →象 L.DDBALL →ハーピー LRLRDURURLAB→ 一致しません DUBLBR →バンディットタウン DURLBA→ 一致しません DDUDR →サル RLAB→ 一致しません .DUUBBB →ティンカーバット DADRDL →クモ …

10
それは真実か偽物ですか?
何かが真実であるかどうかを表現するには、非常に多くの異なる方法があります!この課題の目標は、生産することである標準の出力truthyやfalsy、さまざまな入力truthyとfalsy値のために。 この課題のために、以下の入力は真実と見なされます。 ゼロ以外の値を持つ符号付き整数を表す文字列(数字のみが含まれ、先頭に[0-9]オプションがあります-)。文字列-0が入力として与えられることは決してないことに注意してください。0以外の整数の前にaが付くことは決してありません0(つまり01、入力として与えられることはなく、同様に入力として与えられる-01こともありません)。 いずれかに相当する、大文字と小文字を区別しない文字列defined、found、nonnil、non-nil、on、success、t、true、y、及びyes この課題のために、次の入力は偽物と見なされます。 文字列0。繰り返されるゼロ(00、00...)は入力として与えられません。 空の文字列 いずれかに相当する、大文字と小文字を区別しない文字列f、failure、false、n、nan、nil、no、notfound、not-found、null、nullptr、off、及びundefined 入力 入力は、真偽値を表す文字列です。文字列は任意のソース(stdio、関数パラメーターなど)から取得できます。先頭/末尾の空白はありません。 入力は、上記の許可された真偽値のいずれかに一致することが保証されています(つまり、エラー処理を提供する必要はありません)。 出力 プログラム/関数は、入力の「真実性」または「偽性」を表す真偽値を出力する必要があります。出力で入力を変換する必要がある正確に1つの真偽値と1つの偽値のみを指定できます(これらは「標準化された」真偽値)。出力は、任意のシンク(stdio、戻り値、出力パラメーターなど)に書き込むことができます。 回答で選択したものtruthyとfalsy値を指定してください。 例:文字列trueを真の値として選択した場合、真の整数も使用できません1。 テストケース テストケースは、1行目が入力、2行目が出力であるため、フォーマットされています。 -1 true 1 true 1234 true -4321 true defined true deFined true Found true nonnil true non-nil true ON true SuCCess true T true true true y true YeS true 0 false '' …

16
平らな地球を旅する
平地の世界の座標は、緯度(x)と経度(y)で構成されます。これらは0〜9999の範囲の整数です。ガウス整数によく似ていますが、常に次の表記法を使用して記述されています。 411S 370E すなわちであり、SまたはN緯度に付加し、EまたはW2つのコンポーネント間の空間(S)と、経度に付加します。 ゴール 空白で区切られた2つの座標を読み取り、それらの合計を出力するプログラム(関数ではない)を記述します。最初の座標は開始点、2番目の座標は変位、出力は結果の位置です。 入出力 この課題は部分的にフォーマットに関するものであるため、入力形式と出力形式を明確に定義するようにします。 推奨される入力形式では、座標コンポーネント間に1つのスペースがあり、先行ゼロはなく、2つの座標間に改行文字があります。プログラムは、優先フォーマットを読み取ることができる必要があります。 出力には、任意の量の空白と先行ゼロを含めることができます。推奨される入力形式と異なる場合、プログラムはこの形式も読み取ることができる必要があります。 明確にするために、入力には追加の書式設定文字を含めることはできません(含めません)。必要なスペースと改行だけ。 得点 これは新しい勝利条件の実験です。数週間以内に回答を受け入れて、勝者を選びます。その後、より適切な回答が出た場合は、回答を変更します。 プログラムのスコアはそのバイト数です。優勝したプログラムは、400バイトより短く、バイト数が最も少ないプログラムですが、最も冗長なプログラミング言語で書かれています。勝者を決定するには: バイト数が400以上のプログラムを削除します(参加できますが、勝つことはできません)。 各プログラミング言語の最短プログラムのみを検討する 最長のプログラムの勝利 ポリグロットは、有効なすべての言語のプログラムと競合します(たとえば、プログラムが両方bashで有効である場合、sh両方の言語のプログラムと競合します)。 テストケース テストケースでは、最初の2行が入力で、3行目が出力です。 0S 0E 0S 0W 0N 0E (ゼロの方向は、入力と出力の両方で重要ではありません) 0S 9999E 9999N 9999W 9999N 0E (最大値) 42S 314W 42N 2718W 0N 3032W (ゼロの方向は出力では関係ありません) 5555N 8888W 7777S 0E 2222S 8888W (負の値はありません。符号を変更する必要がある場合は方向を変更してください) 0001N 4545W …
8 code-challenge  arithmetic  parsing  code-golf  interpreter  code-golf  random  classification  code-golf  ascii-art  code-golf  code-golf  string  number  array-manipulation  code-golf  math  rational-numbers  code-golf  internet  classification  code-golf  string  integer  code-golf  number  graphical-output  typography  king-of-the-hill  code-golf  number  sequence  palindrome  code-golf  math  code-golf  math  probability-theory  code-challenge  image-processing  test-battery  code-golf  number-theory  code-golf  tips  swift  code-golf  graphical-output  image-processing  color  code-golf  string  conversion  code-golf  string  array-manipulation  code-golf  encryption  king-of-the-hill  code-golf  string  ascii-art  code-golf  code-golf  string  compression  decision-problem  code-golf  ascii-art  number-theory  division  code-golf  ascii-art  code-golf  code-golf  number  array-manipulation  code-golf  ascii-art  code-golf  code-golf  string  code-golf  sequence  number-theory  code-golf  math  geometry  code-golf  combinatorics  code-golf  integer  code-golf  arithmetic  number-theory  code-golf  arithmetic  restricted-source  number-theory  restricted-complexity 
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.