#include #include //可以使用一些内置函数using namespace std;int isprime(int x);int main(){ int m,n; for(m=101;m<230;m++) { if(isprime(m)) cout<<m<<end...
分类:
其他好文 时间:
2014-08-04 17:09:07
阅读次数:
437
(1)采用IF语句嵌套:#include using namespace std;int main(){ int a; cout>a; if(a>100||a=90&&a=80&&a=70&&a=60&&ausing namespace std;int main(){ int score,t...
分类:
其他好文 时间:
2014-08-04 17:06:17
阅读次数:
178
#include using namespace std;int main(){ int n,a,sum=0; cout>n>>a; for(int i=1;i<=n;i++) { sum+=a; a=a+10*a;//不断赋值替换之前的数值 } cout<<sum<<end...
分类:
其他好文 时间:
2014-08-04 17:03:47
阅读次数:
213
/*
ID: lucien23
PROG: subset
LANG: C++
*/
#include
#include
using namespace std;
int main()
{
ifstream infile("subset.in");
ofstream outfile("subset.out");
if(!infile || !outfile)
{
cout << ...
分类:
其他好文 时间:
2014-08-04 14:35:27
阅读次数:
200
题目链接
题意:给出N,M
执行如下程序:
long long ans = 0,ansx = 0,ansy = 0;
for(int i = 1; i
for(int j = 1; j
if(gcd(i,j) == 1) ans ++,ansx += i,ansy += j;
cout
思路: 首先要会莫比乌斯,然后对于ans,自然是非常好求...
分类:
其他好文 时间:
2014-08-04 14:20:37
阅读次数:
220
#include#includeusing namespace std;int main(){ cout << "n" << ' ' << "e" << endl; cout << "-" << ' ' << "-----------" << endl; cout << 0 << ' ' << 1 ...
分类:
其他好文 时间:
2014-08-04 14:00:57
阅读次数:
170
这两种运算总是感觉有点迷糊,现在 拨开乌云见天日。
对于整型数a,b来说,取模运算或者求余运算的方法都是:
1.求 整数商: c = a/b;
2.计算模或者余数: r = a - c*b.
#include
using namespace std;
void div(){
printf("5/3: %d",5/3);cout << endl;
printf("...
分类:
其他好文 时间:
2014-08-03 18:02:25
阅读次数:
195
计算矩阵的行列式很简单,用det方法或是log_det方法 1 det(A) ? 如果A不是方阵的(square),将抛出std::logic_error异常 例: mat?m?=?"3,2,4;1,-2,3;2,3,2;";
double?d?=?det(m);
cout?<<?d?<<?end...
分类:
其他好文 时间:
2014-08-02 23:37:54
阅读次数:
409
#include#includeusing namespace std;int main(){ const string hexdigits="0123456789ABCDEF"; cout>n) { if(n<hexdigits.size()) ...
分类:
其他好文 时间:
2014-08-02 23:21:04
阅读次数:
218
#include #include using namespace std;int main (){ double a=123456.343001; cout#include using namespace std;int main (){ double a=123456.343001;...
分类:
编程语言 时间:
2014-08-02 23:07:34
阅读次数:
481