結果

問題 No.8005 天使のハッシュ関数
ユーザー Ysmr_Ry
提出日時 2014-12-30 13:34:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 368 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 56,388 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-13 01:07:29
合計ジャッジ時間 1,199 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘std::string md5(const string&)’:
main.cpp:12:15: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         fscanf( fp, "%s", buf );
      |         ~~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<string>

std::string md5( const std::string &s )
{
	std::string cmd = "echo -n "+s+"| md5sum";
	FILE *fp = popen( cmd.c_str(), "r" );

	char buf[50];
	fscanf( fp, "%s", buf );
	fclose(fp);

	return buf;
}

int main()
{
	std::string s;
	std::cin >> s;

	std::cout << md5(md5(s)) << std::endl;

	return 0;
}
0