Saratov State University :: Online Contester


::Go
- home
- news
- register
- update personal info
- problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- links
- projects

::Poll
Are you registered on Codeforces?
Yes
No
What is it???

[results]

::webboard

who can help me ? i am getting WA in test four?
Author: zyt
ID: 045102
Problem: 302
Contest: 0
Date: 2011-07-30 17:04:46

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <vector>
using namespace std;

#define MAXN 1000005

int cont[MAXN];//cont[i]&#34920;&#31034;i&#26159;&#19981;&#21516;&#32032;&#22240;&#23376;&#20010;&#25968;
bool hash[MAXN];

void init(){
memset(cont, 0, sizeof(cont));
memset(hash, true, sizeof(hash));

for (int i = 2; i < MAXN; i++){
if (hash[i]){
for (int j = 1; j * i < MAXN; j++){
cont[i*j]++;
hash[i*j] = false;
}
}
}
}

int min(int a, int b){
return a > b ? b : a;
}

int main(){
int n, m;
init();
scanf("%d%d", &n, &m);

if (m == 1 && n == 1)
printf("0n");
else if (m == 1 || n == 1)
printf("1n");

else{
long long ans = 0;
for (int i = 1; i < min(n,m); i++){

if (cont[i]&1) {
ans -= ((n-1)/i)*((m-1)/i);
}
else {
ans += ((n-1)/i)*((m-1)/i);
}
}
printf("%lldn", ans+2);
}


return 0;
}

who can give me some test cases ? or sent your solution to kingszyt@gmail.com to test my program with.


see sub-tree reply to that message


::Login
Forgot password?

::News
22.10.12 - The problems from the Southern Subregional Programming Contest 2012 added to the problemset archive (542 - 553).
22.10.12 - After the start of the contest the statements in PDF will be available by the link.
23.10.11 - The problems from the Southern Subregional Programming Contest 2011 added to the problemset archive (530 - 541).

::Counter

Server time: 2017-11-23 06:23:57Online Contester Team © 2002 - 2016. All rights reserved.