結果
| 問題 | No.9006 マルチバイト文字テスト(テスト用) |
| ユーザー |
|
| 提出日時 | 2015-03-26 15:19:24 |
| 言語 | C90 (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 518 bytes |
| 記録 | |
| コンパイル時間 | 146 ms |
| コンパイル使用メモリ | 20,864 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-29 01:02:08 |
| 合計ジャッジ時間 | 507 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:26:9: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
26 | fgets(s,768,stdin);
| ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
unsigned char popcnt8(unsigned char n){
const unsigned char m1=0x55;
const unsigned char m2=0x33;
const unsigned char m4=0x0f;
n=((n>>1)&m1)+(n&m1);
n=((n>>2)&m2)+(n&m2);
n=((n>>4)&m4)+(n&m4);
return n;
}
unsigned char clz8(unsigned char n){
n|=n>>1;
n|=n>>2;
n|=n>>4;
return 8-popcnt8(n);
}
void rec(unsigned char *s){
if(*s<32)return;
int n=clz8(~*s);
if(!n)n=1;
rec(s+n);
fwrite(s,1,n,stdout);
}
int main(){
char s[768];
fgets(s,768,stdin);
rec((unsigned char*)s);
return 0;
}