답안 #9132

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
9132 2014-09-27T12:59:18 Z pichulia Actual visible points (kriii2_AC) C++
컴파일 오류
0 ms 0 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
#define M 1000000007LL
int n;
long long int d[100009];
long long int a[100009];
long long int gcd(long long int p,long long int q)
{
  while(p%q)q^=p^=q^=p%=q;
  return q;
}
int main()
{
  int i, j;
  scanf("%d %d",&i,&n);
  if(i>2)printf("%lld\n",(&j)%M);
  else
  {
    for(i=0;i<n;i++)
    {
     scanf("%lld",&a[i]); 
    }
    sort(a,a+n);
    n=unique(a,a+n)-a;
    long long int res = 0;
    for(i=0;i<n;i++)
    {
      res += a[i];
      long long int k = a[i], l;
      for(l=1;l*l<=a[i];l++)
      {
        long long int g;
        g = gcd(a[i],l);
        if(g > 1)
        {
          k -= d[g];
        }
      }
      d[a[i]] = k;
      res += k;
    }
    printf("%lld\n",res);
  }
}

Compilation message

AC.cpp: In function 'long long int gcd(long long int, long long int)':
AC.cpp:10:26: warning: operation on 'p' may be undefined [-Wsequence-point]
AC.cpp:10:26: warning: operation on 'q' may be undefined [-Wsequence-point]
AC.cpp:10:26: warning: operation on 'q' may be undefined [-Wsequence-point]
AC.cpp: In function 'int main()':
AC.cpp:17:31: error: invalid operands of types 'int*' and 'long long int' to binary 'operator%'
AC.cpp:16:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
AC.cpp:22:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]