[CF-214A] 简单枚举

来源:互联网 发布:js正则表达式语法大全 编辑:程序博客网 时间:2024/06/01 07:24

cannot be more straightforward

/* * CF-214A ststem of equations * mike-w * 2012-9-26 */#include<stdio.h>#include<stdlib.h>#include<string.h>int main(void){int n, m;int a, b, c=0;scanf("%d%d", &n, &m);for(a=0; a<=n; a++)for(b=0; b<=n; b++)if(a*a+b==n && a+b*b==m)c++;printf("%d\n", c);return 0;}


原创粉丝点击