3.1. 15이원준 ¶
#include<iostream> using namespace std; int main(){ int arr[46]; int dp[1001] = { 0, }; for(int i = 1; i<45; i++){ arr[i] = (i*(i+1))/2; } for(int i = 1; i<45; i++){ for(int j = 1; j<45 && arr[i] + arr[j] <= 1000; j++){ for(int k = 1;arr[i] + arr[j] + arr[k] <=1000 && k<45; k++){ dp[arr[i] + arr[j] + arr[k]] = 1; } } } int N; cin>> N; for(int i = 0; i<N; i++){ int tmp; cin>> tmp; cout<< dp[tmp] <<endl; } }