Submission #15166098


Source Code Expand

#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(){
  long long n;
  std::cin >> n;

  vector<long long> answers(n+1, 0);

  for(int x=1; x<=100; x++){
    for(int y=1; y<=100; y++){
      for(int z=1; z<=100; z++){
        long long val = pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x;
        if(n < val) continue;
        answers[val] += 1;
      }
    }
  }

  for(int i=1; i<=n; i++){
    std::cout << answers[i] << '\n';
  }

  return 0;
}

Submission Info

Submission Time
Task C - XYZ Triplets
User shrimpName
Language C++ (Clang 10.0.0)
Score 300
Code Size 524 Byte
Status AC
Exec Time 20 ms
Memory 3156 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 3
Set Name Test Cases
Sample sample_01.txt
All hand_01.txt, hand_02.txt, sample_01.txt
Case Name Status Exec Time Memory
hand_01.txt AC 20 ms 3068 KiB
hand_02.txt AC 7 ms 3020 KiB
sample_01.txt AC 7 ms 3156 KiB