A. リトルポニーとクリスタルマイン
テストごとの制限時間
1 秒
テストごとのメモリ制限
256 メガバイト
入力
標準入力
出力
標準出力
トワイライトスパークルはかつてクリスタル鉱山からクリスタルを入手しました。サイズ n の結晶 (n は奇数; n?>?1) は、ダイヤモンドが刻まれた n?×?n 行列です。
奇数の整数 n が与えられます。サイズ n の結晶を描画する必要があります。マトリックスのひし形のセルは文字「D」で表す必要があります。マトリックスの他のすべてのセルは文字「*」で表す必要があります。例を見て、何を描画する必要があるかを理解してください。
入力
唯一の行には整数 n (3?≤?n?≤?101; n は奇数) が含まれています。
出力
出力サイズ n の結晶。
サンプルテスト
入力
出力
RREE
入力
出力
*D*DDD*D*
入力
出力
**D***DDD*DDDDD*DDD***D**
B. リトルポニーとシフトで並べ替え
テストごとの制限時間
1 秒
テストごとのメモリ制限
256 メガバイト
入力
標準入力
出力
標準出力
ある日、Twilight Sparkle は、一連の整数 a1,?a2,?..., を並べ替える方法に興味がありました。 ?an は降順ではありません。若いユニコーンである彼女が実行できる唯一の操作はユニットのシフトです。つまり、シーケンスの最後の要素を先頭に移動できます:
a1,?a2,?...,?an?→?an,?a1,?a2,?...,?an?-? 1.
トワイライト スパークルの計算を手伝ってください: シーケンスを並べ替えるのに必要な操作の最小数は何ですか?
入力 最初の行には整数 n (2?≤?n?≤?105) が含まれています。 2 行目には n 個の整数 a1,?a2,?...,?an(1?≤?ai?≤?105) が含まれています。
出力
シーケンスを並べ替えることが不可能な場合は、-1 を出力します。それ以外の場合は、Twilight Sparkle がソートするために必要な操作の最小数を出力します。
サンプル テスト
入力
***D*****DDD***DDDDD*DDDDDDD*DDDDD***DDD*****D***
入力
#include<iostream>#include<cstring>#include<algorithm>#include<cstdio>using namespace std;char mapp[110][110];int main(){ int i,j; int cas; while(~scanf("%d",&cas)) { memset(mapp,0,sizeof(mapp)); int ans=cas/2; for(i=0;i<cas for if>cas-ans-1) mapp[i][j]='*'; else mapp[i][j]='D'; } ans--; cout=0;i--) cout <p class="sycode"> </p> 出力 <p class="sycode"> </p> <pre style="代码" class="precsshei">22 1
入力
出力
#include<iostream>#include<cstring>#include<algorithm>#include<cstdio>int a[100010];int main(){ int i,j; int cas; int flag=0; int ans=0; while(~scanf("%d",&cas)) { for(i=0;i<cas scanf for if ans break printf else return> <br> <p class="sycode"> </p> <p class="sycode"> C. Little Pony and Expected Maximum </p> <p class="sycode"> </p> <p class="sycode"> time limit per test </p> 1 second <p class="sycode"> </p> <p class="sycode"> memory limit per test </p> 256 megabytes <p class="sycode"> </p> <p class="sycode"> input </p> standard input <p class="sycode"> </p> <p class="sycode"> output </p> standard output <p class="sycode"> </p> <p> Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing. Having returned to the castle, Twilight Sparkle became interested in the dice that were used in the game.</p> <p> The dice has m faces: the first face of the dice contains a dot, the second one contains two dots, and so on, the m-th face contains mdots. Twilight Sparkle is sure that when the dice is tossed, each face appears with probability . Also she knows that each toss is independent from others. Help her to calculate the expected maximum number of dots she could get after tossing the dice n times.</p> <p class="sycode"> </p> <p class="sycode"> Input </p> <p> A single line contains two integers m and n (1?≤?m,?n?≤?105).</p> <p class="sycode"> </p> <p class="sycode"> Output </p> <p> Output a single real number corresponding to the expected maximum. The answer will be considered correct if its relative or absolute error doesn't exceed 10??-?4.</p> <p class="sycode"> </p> <p class="sycode"> Sample test(s) </p> <p class="sycode"> </p> <p class="sycode"> </p> <p class="sycode"> input </p> <pre style="代码" class="precsshei">6 1
output
3.500000000000
input
6 3
output
4.958333333333
input
2 2
output
1.750000000000
Note
Consider the third test example. If you've made two tosses:
- You can get 1 in the first toss, and 2 in the second. Maximum equals to 2.
- You can get 1 in the first toss, and 1 in the second. Maximum equals to 1.
- You can get 2 in the first toss, and 1 in the second. Maximum equals to 2.
- You can get 2 in the first toss, and 2 in the second. Maximum equals to 2.
The probability of each outcome is 0.25, that is expectation equals to:
You can read about expectation using the following link: http://en.wikipedia.org/wiki/Expected_value
#include<iostream>#include<cstdio>#include<cmath>#include<cstring>#include<string>#include<algorithm>using namespace std;int a[100010];typedef double LL;double qpow(double a,int b){ LL ans=1; while(b) { if(b&1) ans*=a; b>>=1; a*=a; } return ans;}int main(){ int n; int m; scanf("%d%d",&n,&m); double ans=0; for(int i=1;i <br> <br> <br> </algorithm></string></cstring></cmath></cstdio></iostream>

HTMLの未来は、よりセマンティック、機能的、モジュール式方向に発展します。 1)セマンティック化により、タグがコンテンツをより明確に説明し、SEOとバリアのないアクセスを改善します。 2)機能化は、ユーザーのニーズを満たすために新しい要素と属性を導入します。 3)モジュール性は、コンポーネントの開発をサポートし、コードの再利用性を改善します。

htmlattributesarecrucialinwebdevevermentmentmentmentmentmentmentmention behavior、like、andfunctionality.theyenhance -interactivity、accessibility、andseo.forexample、thesrcattribute intagsimpactsseo

ALT属性は、HTMLのタグの重要な部分であり、画像の代替テキストを提供するために使用されます。 1.画像をロードできない場合、ALT属性のテキストが表示され、ユーザーエクスペリエンスが向上します。 2。スクリーンリーダーは、ALT属性を使用して、視覚障害のあるユーザーが写真の内容を理解するのに役立ちます。 3. ALT属性のEnginesインデックステキストを検索して、WebページのSEOランキングを改善します。

Web開発におけるHTML、CSS、およびJavaScriptの役割は次のとおりです。1。HTMLは、Webページ構造の構築に使用されます。 2。CSSは、Webページの外観を美化するために使用されます。 3. JavaScriptは、動的な相互作用を実現するために使用されます。タグ、スタイル、スクリプトを通じて、これら3つは最新のWebページのコア関数を構築します。

タグのLang属性を設定することは、WebアクセシビリティとSEOを最適化する重要なステップです。 1)ラング属性をタグに設定します。 2)多言語コンテンツでは、ようなさまざまな言語パーツのLang属性を設定します。 3)「EN」、「FR」、「ZH」などのISO639-1標準に準拠する言語コードを使用します。Lang属性を正しく設定すると、Webページと検索エンジンランキングのアクセシビリティが向上します。

htmlattributeSareSientionalentionalentionalentionalentiallyance'functionalityandappearance.theyaddinformationtodefinebehavior、light、and interaction、makewebsitesteractive、responsive、andviseallyappaleal.attributeslikesrc、href、class、型、およびdoadabledransform

toreatealistinhtml、useforunorderedlistsandfororderedlists:1)forunorderedlists、wrapitemsinanduseforeachitem、renderingasabulletedlist.2)

HTMLは、明確な構造のWebサイトを構築するために使用されます。 1)Webサイト構造などのタグを使用し、定義します。 2)例は、ブログとeコマースのウェブサイトの構造を示しています。 3)誤ったラベルネスティングなどの一般的な間違いを避けてください。 4)HTTP要求を削減し、セマンティックタグを使用してパフォーマンスを最適化します。


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

Safe Exam Browser
Safe Exam Browser は、オンライン試験を安全に受験するための安全なブラウザ環境です。このソフトウェアは、あらゆるコンピュータを安全なワークステーションに変えます。あらゆるユーティリティへのアクセスを制御し、学生が無許可のリソースを使用するのを防ぎます。

ZendStudio 13.5.1 Mac
強力な PHP 統合開発環境

メモ帳++7.3.1
使いやすく無料のコードエディター

VSCode Windows 64 ビットのダウンロード
Microsoft によって発売された無料で強力な IDE エディター

MinGW - Minimalist GNU for Windows
このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。
