楼上的思路不错。有1个错了。cnt < 100不是 <= 100还有一个可以改进。int b_sushu(int date){ for(int i=2;i { //这在数据很大时能提高不少效率。 if(date%i==0) { return -1; } } return 0;}