Last active
December 16, 2015 18:09
-
-
Save yswallow/5475609 to your computer and use it in GitHub Desktop.
http://www.titech.ac.jp/publications/j/techtech17/06.html のNo.2 (C言語)
人力で解くアルゴリズムを考えさせる問題だと思うけど。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main(void) | |
| { | |
| int i,t,sum; | |
| for(i=1;i<250;i++) | |
| { | |
| sum = 0; | |
| for(t=i;sum<500;t++) | |
| { | |
| sum += t; | |
| if(sum==500) | |
| { | |
| printf("%d\n",i); | |
| break; | |
| } | |
| } | |
| } | |
| return 0; | |
| } | |
| //=> 8,59,98 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment