{"id":1345,"date":"2008-07-14T23:31:00","date_gmt":"2008-07-14T14:31:00","guid":{"rendered":"https:\/\/hdmr.org\/d\/?e=61"},"modified":"2008-07-14T23:31:00","modified_gmt":"2008-07-14T14:31:00","slug":"blogn-61","status":"publish","type":"post","link":"https:\/\/hdmr.org\/d\/?e=61","title":{"rendered":"\u304a\u624b\u8efd\u3067\u3042\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u5927\u5207\u3067\u3042\u308b"},"content":{"rendered":"<p>\u5b9f\u306f\u3001\u590f\u4f11\u307f\u306e\u8ab2\u984c\u3067\u3001<br \/>\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u30c7\u30fc\u30bf\u304c\u305f\u304f\u3055\u3093\u3042\u308b\u306e\u3067\u3001\u305d\u308c\u306e\u5e73\u5747\u5024\u3084\u3089\u3092\u6c42\u3081\u308d\u3068\u3002<br \/>\u5e73\u5747\u5024\u3060\u3051\u306a\u3089\u304b\u306a\u308a\u7c21\u5358\u3060\u304c\u3001\u6a19\u6e96\u504f\u5dee\u3082\u6c42\u3081\u3093\u3068\u3044\u304b\u3093\u306e\u3067\u3002<br \/>\u305d\u3093\u306a\u3082\u306e\u306f\u8868\u8a08\u7b97\u306e\u95a2\u6570\u3092\u4f7f\u3048\u3070\u3059\u3050\u7d42\u308f\u308b\u304c\u3001\u307e\u3041\u305d\u3053\u306f\u304d\u3061\u3093\u3068\u8003\u3048\u306a\u3055\u3044\u3068\u3002<br \/>\u3067\u3001Perl\u3067\u3084\u3063\u305f\u3068\u30023\u5206\u3050\u3089\u3044\u3067\u3068\u308a\u3042\u3048\u305a\u306f\u4f5c\u308c\u305f\u304b\u3089\u3001\u7d50\u69cb\u65e9\u3044\u3068\u601d\u3046\u3002<br \/>\u305f\u3060\u3001\u3061\u3087\u3063\u3068\u3053\u306e\u307e\u307e\u63d0\u51fa\u3059\u308b\u306e\u306f\u3042\u308c\u306a\u306e\u3067\u3001\u30d0\u30b0\u53d6\u308a\u306b\u6642\u9593\u3092\u98df\u3063\u305f\u3051\u3069\u3002<\/p>\n<hr \/>\n<p>\u305d\u3082\u305d\u3082\u3001Perl\u3068\u3044\u3046\u306e\u306f\u304b\u306a\u308a\u4e0b\u54c1\u3060\u3051\u3069\u4f7f\u3044\u3084\u3059\u3044\u3082\u306e\u3067\u3059\u3002<br \/>\u305d\u308c\u306f\u914d\u5217\u3084\u6587\u5b57\u5217\u306e\u6271\u3044\u306b\u3057\u3066\u3082\u305d\u3046\u3067\u3001\u3084\u306f\u308a\u6271\u3044\u3084\u3059\u3044\u3002<br \/>C\u3067\u306f\u305d\u3093\u306a\u3082\u306e\u6271\u304a\u3046\u3068\u3059\u308b\u3068\u3001\u5b89\u5168\u88c5\u7f6e\u3070\u3063\u304b\u308a\u306b\u306a\u3063\u3066\u3048\u3089\u304f\u3081\u3093\u3069\u304f\u3055\u3044\u3002<br \/>\u305d\u3093\u306a\u308f\u3051\u3067\u3001Perl\u3067\u66f8\u3044\u305f\u308f\u3051\u3060\u3002<br \/>\u3055\u3089\u306bperl 5.8\u4ee5\u964d\u3001\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u3078\u306e\u5bfe\u5fdc\u304c\u3088\u304f\u306a\u3063\u305f\u306e\u3067\u3001\u3053\u308c\u3092\u4f7f\u308f\u306a\u3044\u7406\u7531\u306f\u306a\u3044\u3067\u3059\u306d\u3002<br \/>\u305d\u306e\u3078\u3093\u306e\u304a\u8a71\u306f\u3001\u4ee5\u524d\u66f8\u3044\u305f\u3001<a href=\".\/index.php?e=28\">\u300c\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u3092\u77e5\u3063\u305fperl\u306f\u4fbf\u5229\u300d<\/a>\u306e\u8a18\u4e8b\u53c2\u7167\u3002<br \/>\u3068\u3053\u308d\u304c\u5b9f\u306f\u3053\u306e\u8a18\u4e8b\u306b\u306f\u5c11\u3057\u8aa4\u308a\u304c\u3042\u3063\u305f\u3068\u3044\u3046\u308f\u3051\u3067\u66f8\u3044\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre>#!\/usr\/bin\/perl<br \/>use encoding 'shiftjis';<br \/>#binmode(STDOUT, \":encoding(shiftjis)\");<br \/>#binmode(STDIN, \":encoding(shiftjis)\");<\/pre>\n<p>UTF-8\u4ee5\u5916\u3067\u66f8\u3044\u305fPerl\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5834\u5408\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>binmode\u306f\u66f8\u304b\u306a\u3044\u3002use encoding\u3067\u793a\u3057\u305f\u306e\u306b\u30bb\u30c3\u30c8\u3055\u308c\u307e\u3059\u3002<br \/>\u3057\u304b\u3057\u3001\u305d\u308c\u3067\u306f\u90fd\u5408\u304c\u60aa\u3044\u3053\u3068\u3082\u3042\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u3002<br \/>\u3082\u3061\u308d\u3093UTF-8\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u3051\u3070\u3044\u3044\u306e\u3060\u3051\u3069\u3001\u3053\u3093\u306a\u89e3\u6c7a\u6cd5\u3082\u3042\u308b\u3068\u3002<\/p>\n<pre>use encoding 'utf8',STDOUT=>'shiftjis';<\/pre>\n<p>\u30d0\u30b0\u53d6\u308a\u3068\u8a00\u3063\u3066\u305f\u3051\u3069\u3001\u3053\u306e\u4e8b\u5b9f\u3092\u77e5\u3089\u306a\u304b\u3063\u305f\u3060\u3051\u3067\u3059\u3002<br \/>\u3061\u3087\u3063\u3068\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\u305d\u306e\u70b9\u4ee5\u5916\u306f\u5b9f\u306b\u30b9\u30e0\u30fc\u30ba\u3067\u3057\u3066\u3001foreach\u3092\u6d3b\u7528\u3057\u3066\u3046\u307e\u3044\u3053\u3068\u66f8\u3051\u307e\u3057\u305f\u3002<br \/>\u3082\u3063\u3068\u3082\u3001\u4eca\u56de\u306e\u306futf8\u30d5\u30e9\u30b0\u3092\u7acb\u3066\u308b\u5fc5\u8981\u306f\u306a\u304b\u3063\u305f\u3093\u3060\u3051\u3069\u306d\u3002\u3051\u3069\u6c17\u6301\u3061\u60aa\u3044\u3057\u3002<\/p>\n<hr \/>\n<p>\u3068\u3053\u308d\u3067\u3001C\u3067\u66f8\u304f\u3068\u3001\u5b89\u5168\u88c5\u7f6e\u3060\u3089\u3051\u306b\u306a\u308b\u3068\u8a00\u3044\u307e\u3057\u305f\u304c\u3001\u5b9f\u969b\u306e\u69d8\u5b50\u3092\u307f\u308c\u3070\u308f\u304b\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre>fp=fopen(\"data.txt\",\"r\");<br \/>if(fp==NULL) abort();<br \/>while(!feof(fp)){<br \/>  str[0]='\\0';<br \/>  fgets(str,32,fp);<br \/>  l=strlen(str);<br \/>  if(l==0)  continue;<br \/>  if(str[l-1]!='\\n'){<br \/>    if(!feof(fp)) abort();<br \/>  }<br \/>  if(sscanf(str,\"%d\",&v)==1){<br \/>    a+=v;<br \/>    n++;<br \/>  }<br \/>}<\/pre>\n<p>\u307e\u305a\u3001\u3053\u306e\u524d\u63d0\u3068\u3057\u3066\u30011\u884c\u306b1\u3064\u3060\u3051\u6574\u6570\u304c\u5165\u3063\u3066\u308b\u3068\u3002<br \/>\u3082\u30571\u884c\u306b2\u3064\u3042\u3063\u3066\u30821\u3064\u3057\u304b\u8aad\u307f\u53d6\u3089\u306a\u3044\u3002\u305d\u3093\u306a\u524d\u63d0\u306a\u306e\u3067\u3084\u305f\u3089\u3081\u3093\u3069\u304f\u3055\u3044\u3002<br \/>\u5b89\u5168\u306e\u305f\u3081\u306b\u306f\u3053\u3061\u3089\u306e\u65b9\u304c\u3088\u3044\u3067\u3057\u3087\u3046\u3002<br \/>\u307e\u305a\u3001\u30d5\u30a1\u30a4\u30eb\u30dd\u30a4\u30f3\u30bf\u304cNULL\u3067\u306a\u3044\u304b\u78ba\u8a8d\u3002\u3053\u3053\u3067NULL\u306a\u3089abort\u3067\u3068\u308a\u3042\u3048\u305a\u5f85\u907f\u3002<br \/>fgets\u306e\u8a71\u306f\u4ee5\u524d\u3082\u3057\u305f\u3088\u3046\u306b\u601d\u3046\u3051\u3069\u3001gets\u3067\u306f\u30e1\u30e2\u30ea\u7834\u58ca\u304c\u8d77\u304d\u3066\u3057\u307e\u3046\u3002<br \/>\u3060\u304b\u3089fgets\u3092\u4f7f\u3063\u3066\u3001\u30e1\u30e2\u30ea\u7834\u58ca\u3092\u9632\u3050\u3002<br \/>\u3059\u308b\u3068\u5c3b\u304c\u5207\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u3002\u306a\u306e\u3067\u3001fgets\u306e\u6027\u8cea\u3067\u3001\u6700\u5f8c\u306b\u6539\u884c\u3082\u5165\u308b\u3068\u3044\u3046\u306e\u304c\u3042\u308b\u304b\u3089\u78ba\u8a8d\u3059\u308b\u3002<br \/>\u305d\u308c\u3067\u6539\u884c\u304c\u3042\u308b\u304b\u78ba\u8a8d\u3057\u3066\u3001\u306a\u3051\u308c\u3070abort\u3002<br \/>\u305d\u308c\u3067sscanf\u3067\u305d\u306e\u6587\u5b57\u5217\u3092\u89e3\u6790\u3059\u308b\u3002\u3053\u3053\u30671\u3064\u8aad\u307f\u53d6\u308b\u3053\u3068\u306b\u6210\u529f\u3057\u306a\u3051\u308c\u3070\u5024\u3092\u52a0\u7b97\u3057\u306a\u3044\u3002<br \/>\u3068\u3053\u308d\u304c\u3053\u306e\u307e\u307e\u3067\u306f\u6700\u7d42\u884c\u4ed8\u8fd1\u3067\u304a\u304b\u3057\u306a\u3053\u3068\u304c\u8d77\u304d\u308b\u3002<br \/>\u307e\u305a\u3001\u6700\u7d42\u884c\u304c\u4f55\u3082\u306a\u3044\u3068\u304d\u3002\u3060\u304b\u3089\u3001\u6700\u5f8c\u306e\u30c7\u30fc\u30bf\u306e\u3042\u3068\u6539\u884c\u3060\u3051\u3067\u7d42\u308f\u3063\u3066\u308b\u3068\u304d\u3067\u3059\u3002<br \/>\u3053\u306e\u3068\u304d\u3001\u306a\u305c\u304bfgets\u3067\u8aad\u307f\u53d6\u3089\u306a\u3044\u3002\u305d\u308c\u3067\u6587\u5b57\u5217\u306e\u5185\u5bb9\u304c\u5909\u308f\u3089\u306a\u3044\u3002\u306a\u306e\u3067\u540c\u3058\u30c7\u30fc\u30bf\u30922\u56de\u8aad\u3080\u3002<br \/>\u3060\u304b\u3089\u30011\u6587\u5b57\u76ee\u306e\u3068\u3053\u308d\u3092&#8217;\\0&#8217;\u306b\u3057\u3066\u3001\u5f37\u5236\u7684\u306b\u6587\u5b57\u5217\u306e\u9577\u3055\u30920\u306b\u3057\u3066\u30010\u306e\u307e\u307e\u306a\u3089\u3084\u308a\u76f4\u3057\u3068\u3002<br \/>\u3068\u3044\u3063\u3066\u3082\u3001\u3053\u308c\u306f\u6700\u7d42\u884c\u4ee5\u5916\u306f\u3042\u308a\u3048\u306a\u3044\u3053\u3068\u306a\u306e\u3067\u3001\u5b9f\u8cea\u305d\u306e\u305f\u3081\u3060\u3051\u3067\u3059\u306d\u3002<br \/>\u6539\u884c\u306e\u5f8c\u306b\u4f59\u5206\u306a\u7a7a\u767d\u306a\u3069\u304c\u3042\u3063\u305f\u3089\u3001\u305d\u3053\u304b\u3089\u6574\u6570\u304c\u8aad\u307f\u53d6\u3089\u308c\u306a\u3051\u308c\u3070\u3001\u5024\u3092\u52a0\u7b97\u3057\u306a\u3044\u3060\u3051\u3067\u7279\u306b\u554f\u984c\u306a\u3057\u3002<br \/>\u3082\u30461\u3064\u306f\u6700\u5f8c\u306e\u30c7\u30fc\u30bf\u306e\u3042\u3068\u6539\u884c\u7121\u3057\u306e\u3068\u304d\u3002\u3053\u306e\u3068\u304d\u306f\u6700\u5f8c\u306b\u6539\u884c\u304c\u5165\u3089\u306a\u3044\u3002<br \/>\u3057\u304b\u3057\u305d\u306e\u3068\u304d\u306fEOF\u306b\u5230\u9054\u3057\u3066\u308b\u306f\u305a\u3060\u304b\u3089\u3001\u78ba\u8a8d\u3057\u3066\u3001\u5230\u9054\u3057\u3066\u306a\u3051\u308c\u3070abort\u3068\u3002<\/p>\n<hr \/>\n<p>\u3053\u3053\u307e\u3067\u3059\u308b\u304b\u3068\u3044\u3046\u304b\u3082\u77e5\u308c\u306a\u3044\u3051\u3069\u3001\u307e\u3041\u3053\u306e\u7a0b\u5ea6\u306f\u3057\u306a\u3044\u3068\u3044\u304b\u3093\u306e\u3088\u306d\u3002<br \/>\u4eca\u56de\u306fC\u3067\u3084\u308b\u3053\u3068\u524d\u63d0\u306e\u30c7\u30fc\u30bf\u306a\u306e\u3067\u307e\u3060\u307e\u3057\u3067\u3059\u304c\u3001<br \/>1\u884c\u306b2\u30641\u7d44\u3042\u308b\u3068\u304d\u3068\u304b\u8003\u3048\u308b\u3068\u306a\u304b\u306a\u304b\u3053\u3046\u3082\u3044\u304b\u3093\u3067\u3057\u3087\u3046\u3002<br \/>Perl\u3067\u3042\u308c\u3070\u304b\u306a\u308a\u3053\u306e\u8fba\u306e\u878d\u901a\u306f\u52b9\u304d\u307e\u3059\u306d\u3002<br \/>\u6587\u5b57\u5217\u51e6\u7406\u306f\u975e\u5e38\u306b\u5f37\u3044\u304b\u3089\u3001\u304b\u306a\u308a\u3044\u3051\u308b\u3002<br \/>\u307e\u3041\u3068\u3093\u3067\u3082\u306a\u3044\u6027\u80fd\u3092\u8981\u6c42\u3059\u308b\u306a\u3089\u3068\u3082\u304b\u304f\u3001C\u3067\u3084\u308b\u30e1\u30ea\u30c3\u30c8\u306f\u5c11\u306a\u3044\u3067\u3057\u3087\u3046\u3002\u305d\u308c\u306b\u305d\u3093\u306a\u3053\u3068\u306f\u306a\u3044\u3002<br \/>\u306a\u3089Perl\u3084\u3089\u3067\u30d1\u30c3\u3068\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u3044\u3066\u3001\u3046\u307e\u3044\u3053\u3068\u52d5\u3044\u3066\u304f\u308c\u308b\u3053\u3068\u3092\u671f\u5f85\u3057\u3066\u5f85\u3063\u3066\u304a\u3051\u3070\u3044\u3044\u3002<br \/>\u672c\u5f53\u306bC\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u66f8\u304f\u3068\u3001\u3057\u3087\u3063\u3061\u3085\u3046\u30e1\u30e2\u30ea\u7834\u58ca\u8d77\u3053\u3059\u304b\u3089\u306d\u3002<br \/>\u5c11\u3057\u306a\u3089\u3042\u307e\u308a\u5f71\u97ff\u306a\u3044\u3068\u306f\u3044\u3048\u3001\u305d\u308c\u306f\u5076\u7136\u3002\u3084\u306f\u308a\u3067\u304d\u308b\u3060\u3051\u306e\u5de5\u592b\u306f\u3057\u306a\u3044\u3068\u306d\u3002<br \/>\u307e\u3041\u3001\u3053\u308c\u306b\u3064\u3044\u3066\u306fC\u306e\u914d\u5217\u306e\u4ed5\u7d44\u307f\u306f\u6975\u7aef\u306b\u30d7\u30ed\u30b0\u30e9\u30de\u4efb\u305b\u306a\u305b\u3044\u3060\u3051\u3069\u306d\u3002<br \/>\u305d\u306e\u8fba\u7ba1\u7406\u3057\u3066\u304f\u308c\u308b\u3082\u306e\u306f\u3044\u3044\u3057\u3001Perl\u306e\u914d\u5217\u306f\u53ef\u5909\u9577\u3060\u304b\u3089\u306d\u3002\u3053\u308c\u3082\u3044\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b9f\u306f\u3001\u590f\u4f11\u307f\u306e\u8ab2\u984c\u3067\u3001\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u30c7\u30fc\u30bf\u304c\u305f\u304f\u3055\u3093\u3042\u308b\u306e\u3067\u3001\u305d\u308c\u306e\u5e73\u5747\u5024\u3084\u3089\u3092\u6c42\u3081\u308d\u3068\u3002\u5e73\u5747\u5024\u3060\u3051\u306a\u3089\u304b\u306a\u308a\u7c21\u5358\u3060\u304c\u3001\u6a19\u6e96\u504f\u5dee\u3082\u6c42\u3081\u3093\u3068\u3044\u304b\u3093\u306e\u3067\u3002\u305d\u3093\u306a\u3082\u306e\u306f\u8868\u8a08\u7b97\u306e\u95a2\u6570\u3092\u4f7f\u3048\u3070\u3059\u3050\u7d42\u308f\u308b\u304c\u3001\u307e\u3041\u305d\u3053\u306f\u304d\u3061\u3093\u3068\u8003 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1345","post","type-post","status-publish","format-standard","hentry","category-computer"],"_links":{"self":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/1345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1345"}],"version-history":[{"count":0,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/1345\/revisions"}],"wp:attachment":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}