結果
| 問題 | No.254 文字列の構成 | 
| コンテスト | |
| ユーザー |  nablaenergy_21 | 
| 提出日時 | 2015-07-31 11:15:32 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 5,000 ms | 
| コード長 | 302 bytes | 
| コンパイル時間 | 235 ms | 
| コンパイル使用メモリ | 31,616 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-17 22:53:29 | 
| 合計ジャッジ時間 | 1,566 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 30 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d",&N);
      |         ~~~~~^~~~~~~~~
            
            ソースコード
#include <stdio.h>
#include <math.h>
int main(void){
	int N,c,p;
	int i;
	char x[2];
	scanf("%d",&N);
	c = 0;
	while(N>0){
		x[0] = 'a' + c%3;
		x[1] = 'a' + c%3+3;
		p = sqrt(N);
		for(i=0;i<p-1;i++){
			printf("%c%c",x[0],x[1]);
		}
		printf("%c",x[0]);
		N = N - p*p;
		c++;
	}
	printf("\n");
}
            
            
            
        