デジタルちんぶろぐ

デジタルな話題

ホーム 連絡をする 同期する ( RSS 2.0 ) Login
投稿数  268  : 記事  0  : コメント  4375  : トラックバック  79

ニュース


技術以外は
ちんぶろぐ

記事カテゴリ

書庫

日記カテゴリ

そんなお題を見つけたのでやってみる。相変わらず目標はtwitterで呟くことが出来る140文字以内。

int n,c,i;main(){for(;i<1001;n=++i)while(c+=!(n%10),n/=10);printf("%d\n",c);}

出来た。77文字。

なんかパターンがマンネリ化している^^;

 

今回書いていて今更過ぎる発見をした。

do;while(0);

これは合法みたいだ。doの後ろは{}で括るという先入観が有ったから気付かなかった。

投稿日時 : 2010年7月22日 1:04

コメント

# 前フリチックにGo-Lang、片桐風味を添えて、~その3~ 2010/07/22 7:21 すいません、VB4しかやってないんです、VBAはやったけど(ぼそ)
前フリチックにGo-Lang、片桐風味を添えて、~その3~

# 前フリチックにGo-Lang、片桐風味を添えて、~その3~ 2010/07/22 12:53 すいません、VB4しかやってないんです、VBAはやったけど(ぼそ)
前フリチックにGo-Lang、片桐風味を添えて、~その3~

# re: 0から1000までの0の数を数える 2010/07/22 23:59 こあら
VBScriptで参加!

for i=0 to 1000:s=s&i:next:msgbox ubound(split(s,"0"))


# 0から1000の0の数を数える 2010/07/23 0:28 FloralCompany.log
ネタ元達 -&gt; http://blogs.wankuma.com/episteme/archive/2010/07/22/191478.aspx http://blogs.wankuma.com/andochin/archive/2010/07/22/191446.aspx http://blogs.wankuma.com/esten/archive/2010/07/22/191451.aspx http://hidori.spaces.live.com/Blog/cns!F11BB9FD8E1BC5F9!2495.entry http://gist.github.com/415551 http://d.hatena.ne.jp/os0x/20081115/1226770265 http://d.hatena.ne.jp/mzp/20081115/countzero http://d.hatena.ne.jp/rubikitch/20081112/1226490264 http://rubyist.g.hatena.ne.jp/krystal/20081110 んで、 perl で one-liner perl -E 'say scalar grep!$_,map{split//}0..1000' # ネタ元の紹介の方が長いとかどういう......

# 0から1000までの0~9の数を数える 2010/07/23 1:58 デジタルちんぶろぐ
0から1000までの0~9の数を数える

# re: 0から1000までの0の数を数える 2010/07/23 1:59 あんどちん
コメントありがとうございます。
VBScriptやperlの方が短く書けるんですね。これに関してはCでもそこそこいいセン行けると思ってたんですが^^

# re: 0から1000までの0の数を数える 2010/07/23 2:35 むたぐち
PowerShellで参戦!
(((0..1000) -join "") -replace "[1-9]","").length

# re: 0から1000までの0の数を数える 2010/07/23 10:30 あんどちん
>> むたぐちさん
あ、なるほど。0-1000までの数値文字列を作って1-9までの文字を""へ置換して文字列の長さを得ると。


# re: 0から1000までの0の数を数える 2010/07/23 11:09 Flast
先頭の"int "の4文字は削れますね。
Cでは型が明示的に指定されていないグローバル変数はすべてint型として扱われます。golfではよく使われる手段ですね。

# re: 0から1000までの0の数を数える 2010/07/23 12:07 あんどちん
>> Flastさん
> Cでは型が明示的に指定されていないグローバル変数はすべてint型として扱われます。
ご指摘ありがとうございます。これは盲点でした。関数の戻り値の型指定が無いとintと判断されるのは知っていたのですが…
これで4文字削れました。

# 無駄に並列化してみる 2010/07/25 12:07 とっちゃん's Blog
無駄に並列化してみる

# re: 0から1000までの0の数を数える 2010/07/25 18:07 Flast
http://d.hatena.ne.jp/Flast/20100725
いい感じに盛り上がっててたのしいですね
並列化ならやっぱ超並列でしょ

# re: 0から1000までの0の数を数える 2010/07/25 22:25 あんどちん
GPGPUをやる人が出るのかなーと思ってました。
こうなると誰かがCellをやってくれるんじゃないかと期待してしまいますw

# re: 0から1000までの0の数を数える 2010/07/25 22:30 Flast
Cellかぁ。残念ながらCellはできないなぁ。
今から勉強してもいいけど...

# re: 0から1000までの0の数を数える 2010/07/26 10:49 あんどちん
GPGPUの類似技術だとCellかなーと思っただけです。PS3にLinux等が入れられなくなった今となっては動かす方法が難しいでしょうし。
僕はそちら方面の技術に疎いので他にもOpenCLやATI Streamだとどうなるんだろう?と気になります。
そもそもCUDAとOpenCL,ATIStreamが同列に語れるものかどうかすら知らないんですが^^;


# kYhQpZrDbbsqZwIn 2011/12/13 18:36 http://www.d4women.net/clomid.php
Current blog, fresh information, I read it from time to time!!...

# Illikebuisse xqcnj 2021/07/04 21:40 pharmaceptica
hydroxychoriquine https://www.pharmaceptica.com/

# buy essay online for cheap x425kp 2022/09/03 17:18 Charlosmox

With thanks, Quite a lot of stuff.
https://definitionessays.com/ masters degree thesis

# writing essays custom e26ogw 2022/09/08 18:05 Charlosmox

Wonderful forum posts. With thanks! https://definitionessays.com/ how to write an essay in college

# aralen canada 2022/12/29 15:00 MorrisReaks
https://hydroxychloroquinex.com/ what is hydroxychloroquine

# write a term paper f324bx 2023/02/10 0:28 Albertosed
You actually suggested this superbly!
https://essaywritingservicelinked.com/ dissertation proposal help

# buy essay paper f29zod 2023/02/26 12:54 CharlesSnoff

Wow quite a lot of fantastic information.
essay order https://quality-essays.com/ buy argumentative essays online

# dissertation methodology help x46iyh 2023/02/27 3:23 Robertsaids

Very good data, Appreciate it.
someone write my dissertation https://dissertationwritingtops.com/ custom dissertation writing service

# online research paper writing services t35qaa 2023/03/01 2:34 StevenGrelo

Many thanks! Great stuff.
best computer college paper writing service https://service-essay.com/ survey research paper writing service

# english literature essay help v147xe 2023/03/06 6:29 EugeneSib

Great material. Kudos.
writing an explanatory essay https://payforanessaysonline.com literature review dissertation https://essaywritingservicebbc.com

# custom writing cheap d24hfm 2023/03/06 9:43 Gregorysaipt
You expressed it very well!
dissertation writing uk https://buycheapessaysonline.com do my dissertation https://hireawriterforanessay.com

# how to write essay introduction h29hwj 2023/03/06 21:39 EugeneSib

Awesome information, With thanks.
write my essay for money https://buycheapessaysonline.com help in writing an essay https://homeworkcourseworkhelps.com

# what is college for essay z226pe 2023/03/08 4:43 EugeneSib

Incredible lots of awesome knowledge.
harvard college essay https://custompaperwritersservices.com buy essay paper https://buycheapessaysonline.com

# write an essay introduction z700yb 2023/03/09 12:24 EugeneSib

Thanks! A lot of forum posts.
literature dissertation https://service-essay.com mba thesis writers https://essaywritingserviceahrefs.com

# need an essay written x60xds 2023/03/10 2:16 Gregorysaipt

Nicely put, Kudos!
buying essay https://essaytyperhelp.com learn how to write essay https://hireawriterforanessay.com

# how to type a college essay x675vs 2023/03/10 23:50 Gregorysaipt

With thanks! I enjoy it.
how to write an english essay https://domyhomeworkformecheap.com good books to write essays on https://buycheapessaysonline.com

# help writing speech u43sba 2023/03/11 8:23 EugeneSib

Truly quite a lot of amazing tips.
writing thesis https://ouressays.com writing essay help https://domyhomeworkformecheap.com

# writing your dissertation h26oht 2023/03/11 21:36 Gregorysaipt

Terrific facts, With thanks.
how to write essays for college https://paperwritingservicecheap.com dissertation writing services https://essayservicehelp.com

# dissertation of o64ubd 2023/03/12 13:58 EugeneSib

Reliable tips. With thanks.
how to write a compare and contrast essay introduction https://hireawriterforanessay.com dissertation assistance service https://bestonlinepaperwritingservices.com

# dissertation fellowships c60ekb 2023/03/12 19:19 Gregorysaipt

With thanks, Helpful stuff!
dissertation statistics https://essaypromaster.com college application essay help online https://writingthesistops.com

# essay writers for pay m450lx 2023/03/13 4:37 EugeneSib
You actually revealed this effectively.
buy an essay online cheap https://englishessayhelp.com writing mba essays https://studentessaywriting.com

# how to write a compare essay r20hpt 2023/04/02 21:35 EugeneSib

Appreciate it, An abundance of advice!
college application essay writing service https://paperwritingservicecheap.com custom application essay https://researchpaperwriterservices.com

# The plugins developed for WordPress 2023/05/10 0:46 Justas
The plugins developed for WordPress serve to enhance the features and functions of a WordPress website, allowing you to build your awesome and functional site https://t.me/wpigaming/648 Customise WordPress with powerful, professional and intuitive fields.

# ed medications https://edpills.tech/# top erection pills 2023/12/23 11:02 EdPills
ed medications https://edpills.tech/# top erection pills

# buy cytotec https://cytotec.icu/ buy cytotec pills 2024/01/05 14:59 Cytotec
buy cytotec https://cytotec.icu/ buy cytotec pills

# lana rhoades solo - https://lanarhoades.pro/ lana rhoades pics
2024/03/06 18:51 LanaRho
lana rhoades solo - https://lanarhoades.pro/ lana rhoades pics


# sweetie fox cosplay https://sweetiefox.pro/ - sweetie fox
2024/03/06 23:23 SwitieFox
sweetie fox cosplay https://sweetiefox.pro/ - sweetie fox


# eva elfie https://evaelfie.site/ eva elfie full videos
2024/03/07 7:39 EvaElfie
eva elfie https://evaelfie.site/ eva elfie full videos


# aviator https://aviatormocambique.site aviator
2024/03/12 2:24 AviatorMaz
aviator https://aviatormocambique.site aviator


# aviator pin up https://aviatorjogar.online/ - jogar aviator online
2024/03/13 0:42 BraAvia
aviator pin up https://aviatorjogar.online/ - jogar aviator online


# gates of olympus max win - https://gatesofolympus.auction/ gates of olympus s&#305;rlar&#305; 2024/03/27 21:50 Olympic
gates of olympus max win - https://gatesofolympus.auction/ gates of olympus s&#305;rlar&#305;

# sweet bonanza https://sweetbonanza.bid/ - sweet bonanza mostbet
2024/03/28 1:03 Bonanzaj
sweet bonanza https://sweetbonanza.bid/ - sweet bonanza mostbet


Post Feedback

タイトル
名前
Url:
コメント: