<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>评论：关于87.53%的数学分析</title> <atom:link href="http://gccfeli.cn/2009/12/87-53-mathematical-analysis.html/feed" rel="self" type="application/rss+xml" /><link>http://gccfeli.cn/2009/12/87-53-mathematical-analysis.html</link> <description></description> <lastBuildDate>Wed, 14 Mar 2012 03:06:49 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1</generator> <item><title>由：Felicia</title><link>http://gccfeli.cn/2009/12/87-53-mathematical-analysis.html/comment-page-1#comment-812</link> <dc:creator>Felicia</dc:creator> <pubDate>Fri, 19 Feb 2010 07:59:57 +0000</pubDate> <guid
isPermaLink="false">http://gccfeli.cn/2009/12/%e5%85%b3%e4%ba%8e87-53%e7%9a%84%e6%95%b0%e5%ad%a6%e5%88%86%e6%9e%90.html#comment-812</guid> <description>随手写了个，没考虑时间效率，sorry</description> <content:encoded><![CDATA[<p>随手写了个，没考虑时间效率，sorry</p> ]]></content:encoded> </item> <item><title>由：ff8885b</title><link>http://gccfeli.cn/2009/12/87-53-mathematical-analysis.html/comment-page-1#comment-808</link> <dc:creator>ff8885b</dc:creator> <pubDate>Wed, 10 Feb 2010 10:05:59 +0000</pubDate> <guid
isPermaLink="false">http://gccfeli.cn/2009/12/%e5%85%b3%e4%ba%8e87-53%e7%9a%84%e6%95%b0%e5%ad%a6%e5%88%86%e6%9e%90.html#comment-808</guid> <description>为什么要用两层循环啊？明明可以O(2n)的情况下解决啊，干嘛用O（n*n）啊
#include
#include
int main() {
char t[10];
int sample_size, cnt = 0;
printf(&quot;Please enter a percentage with two decimal places (like 87.53), I will help you deside how it is calculated: &quot;);
scanf(&quot;%s&quot;, t);
printf(&quot;Please enter the sample size: &quot;);
scanf(&quot;%d&quot;, &amp;sample_size);
for (int i = 0; i &lt;= sample_size; ++i) {
char s[10];
int j;
j=i*atof(t);
sprintf(s, &quot;%.2lf&quot;, j * 100.0 / i);
if (strcmp(s, t) == 0) {
printf(&quot;%d/%d = %lf%%\n&quot;, j, i, j * 100.0 / i);
++cnt;
}
j=i*atof(t)+1;
sprintf(s, &quot;%.2lf&quot;, j * 100.0 / i);
if (strcmp(s, t) == 0) {
printf(&quot;%d/%d = %lf%%\n&quot;, j, i, j * 100.0 / i);
++cnt;
}
}
printf(&quot;Total possibilities = %d\n&quot;, cnt);
return 0;
}</description> <content:encoded><![CDATA[<p>为什么要用两层循环啊？明明可以O(2n)的情况下解决啊，干嘛用O（n*n）啊<br
/> #include<br
/> #include</p><p>int main() {<br
/> char t[10];<br
/> int sample_size, cnt = 0;<br
/> printf(&#8220;Please enter a percentage with two decimal places (like 87.53), I will help you deside how it is calculated: &#8220;);<br
/> scanf(&#8220;%s&#8221;, t);</p><p> printf(&#8220;Please enter the sample size: &#8220;);<br
/> scanf(&#8220;%d&#8221;, &amp;sample_size);</p><p> for (int i = 0; i &lt;= sample_size; ++i) {<br
/> char s[10];<br
/> int j;<br
/> j=i*atof(t);<br
/> sprintf(s, &quot;%.2lf&quot;, j * 100.0 / i);<br
/> if (strcmp(s, t) == 0) {<br
/> printf(&quot;%d/%d = %lf%%\n&quot;, j, i, j * 100.0 / i);<br
/> ++cnt;<br
/> }<br
/> j=i*atof(t)+1;<br
/> sprintf(s, &quot;%.2lf&quot;, j * 100.0 / i);<br
/> if (strcmp(s, t) == 0) {<br
/> printf(&quot;%d/%d = %lf%%\n&quot;, j, i, j * 100.0 / i);<br
/> ++cnt;<br
/> }<br
/> }<br
/> printf(&quot;Total possibilities = %d\n&quot;, cnt);<br
/> return 0;<br
/> }</p> ]]></content:encoded> </item> <item><title>由：Felicia</title><link>http://gccfeli.cn/2009/12/87-53-mathematical-analysis.html/comment-page-1#comment-791</link> <dc:creator>Felicia</dc:creator> <pubDate>Mon, 21 Dec 2009 09:28:56 +0000</pubDate> <guid
isPermaLink="false">http://gccfeli.cn/2009/12/%e5%85%b3%e4%ba%8e87-53%e7%9a%84%e6%95%b0%e5%ad%a6%e5%88%86%e6%9e%90.html#comment-791</guid> <description>晕……果然有漏洞。多谢提醒</description> <content:encoded><![CDATA[<p>晕……果然有漏洞。多谢提醒</p> ]]></content:encoded> </item> <item><title>由：felix021</title><link>http://gccfeli.cn/2009/12/87-53-mathematical-analysis.html/comment-page-1#comment-786</link> <dc:creator>felix021</dc:creator> <pubDate>Thu, 17 Dec 2009 11:25:18 +0000</pubDate> <guid
isPermaLink="false">http://gccfeli.cn/2009/12/%e5%85%b3%e4%ba%8e87-53%e7%9a%84%e6%95%b0%e5%ad%a6%e5%88%86%e6%9e%90.html#comment-786</guid> <description>int t[10]; &lt;-- 溢出攻击你的代码，哇哈哈scanf(&quot;%10s&quot;, t); &lt;-- 这么写～。～</description> <content:encoded><![CDATA[<p>int t[10]; &lt;&#8211; 溢出攻击你的代码，哇哈哈</p><p>scanf(&quot;%10s&quot;, t); &lt;&#8211; 这么写～。～</p> ]]></content:encoded> </item> <item><title>由：jjymhkx0820</title><link>http://gccfeli.cn/2009/12/87-53-mathematical-analysis.html/comment-page-1#comment-784</link> <dc:creator>jjymhkx0820</dc:creator> <pubDate>Thu, 17 Dec 2009 09:17:45 +0000</pubDate> <guid
isPermaLink="false">http://gccfeli.cn/2009/12/%e5%85%b3%e4%ba%8e87-53%e7%9a%84%e6%95%b0%e5%ad%a6%e5%88%86%e6%9e%90.html#comment-784</guid> <description>这个好牛哈，哈哈。</description> <content:encoded><![CDATA[<p>这个好牛哈，哈哈。</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 3/15 queries in 0.006 seconds using disk

Served from: gccfeli.cn @ 2012-05-22 06:55:49 -->
