Prompt to Production Custom GPT: Custom GPT Specification 1120
Prompt to Production Custom GPT: Custom GPT Specification 1120 is a verified PROMPT blueprint on Promptally in System & Base Contexts optimized for leading AI models. Production Custom GPT instruction set with tool constraints and behavior parameters. Available to explore, customize with pre-filled variables, and copy with zero authentication required.
Technical Specifications
| Specification | Value |
|---|---|
| Artifact type | PROMPT (System & Base Contexts) |
| Compatible engines | Universal / Model Agnostic |
| Input variables | None (pre-filled) |
| Approximate tokens | 2,102 |
| Source file | prompt-production-custom-gpt-custom-gpt-specification-1120.txt |
| Access tier | Free public (MIT) |
Pre-Filled Template
1. **问题:打印字母图案**
指令:编写一个程序,输出下面显示的图案,并以换行符结束。图案的每一行包含5个字符,包括空格。
输出:
H H H H HHHHH H H H H
解决方案:public class LabProgram { public static void main(String[] args) { System.out.println("H H"); System.out.println("H H"); System.out.println("HHHHH"); System.out.println("H H"); System.out.println("H H"); } }
操作指导:只需注意每行需要多少个字符,然后使用 System.println();
2. **问题:乘法**
指令:在这个实验中,你将使用单元测试来检查一个空设置使用断言。使用提供的注释模板代码,编写一个程序,收集两个整数输入并将它们赋值给变量starting_num和multiplier。将starting_num乘以multiplier并输出结果。重复这个过程两次,每次都将上一个结果乘以multiplier。三个乘积输出应该由空格字符分隔,并以换行符结束。
输入:[起始数字]:2 [乘数]:5
输出:10 50 250
解决方案:import java.util.Scanner; public class LabProgram{ public static void main(String[] args){ Scanner scnr = new Scanner(System.in); int startingNum = scnr.nextInt(); int multiplier = scnr.nextInt(); int result = startingNum; String output = ""; for (int i = 0; i < 3; i++){ result *= multiplier; if (i <= 1){ output += result + " "; } else { output += result; } } System.out.println(output); } }
操作指导:我们需要从用户那里获取输入,所以需要导入 java.util.Scanner 创建类 public class LabProgram{ 创建主方法 public static void main (String[] args){ 创建 Scanner 对象 Scanner scnr = new Scanner(System.in); 创建变量(其中4个起始数 multiplier 结果 output)int starting_num = scnr.NextInt(); int multiplier = scnr.NextInt(); int result = starting_num String output = ""; 创建循环 for (i=0; i<【问题要求的迭代次数】; i++){ result *= multiplier; if(i <=1){ output += result + " "; else{ output += result; 打印值 System.out.println(output);
3. **问题:婚礼桌位**
指令:编写一个程序,根据预期宾客人数计算出满座桌位的数量。每个满座桌位可容纳10位婚礼宾客。收集一个整数输入并将其赋值给变量guests。使用整数除法计算将被填满的桌子总数。变量tableSize已被声明并初始化,变量guests和tablesFilled已在模板代码中声明。输出填满的桌数,并以换行符结束。确保你的程序输出与下面的示例格式匹配,并能适用于各种输入值。
输入:340
输出:Tables filled: 34
输入:349
输出:Tables filled: 34
解决方案:import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int tableSize=10; int guests = Integer.valueOf(scnr.nextLine()); int tablesFilled = guests / tableSize; System.out.println("Tables filled: " + tablesFilled); } }
操作指导:这个程序需要输入,所以我们需要导入 java.util.Scanner; 创建类 public class LabProgram{ 创建方法 public static void main(String[] args){ 创建 Scanner,tableSize,guests和tables filled变量 Scanner scnr = New Scanner(System.in); int tables = 10; int guests = Integer.ValueOf(scnr.NextLine); int tablesFilled = guests/tableSize; 输出桌数 System.out.println("Tables filled: " + tablesFilled);
4. **问题:姓名/薪资**
指令:编写一个程序,分别在不同行上输入全名、年龄和薪资。输出一个包含输入内容的格式化信息,并以换行符结束。确保你的程序输出与下面的示例格式匹配,并能适用于各种输入值。
输入:Pat Ford 35 60000
输出:Pat Ford is 35 and makes $60000.
解决方案:import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String name = scnr.nextLine(); String age = scnr.nextLine(); String salary = scnr.nextLine(); System.out.println(name + " is " + age + " and makes $" + salary + "."); } }
操作指导:导入必要工具 为了从用户那里获取输入,导入 Scanner 类。import java.util.Scanner; 定义你的类 通过定义其类开始你的Java程序。public class LabProgram{ 主方法入口 Java程序从main方法开始执行。public static void main(String[] args){ 初始化 Scanner 对象 设置 Scanner 以读取用户输入。Scanner scnx = new Scanner(System.in); 收集用户输入 按顺序获取三个输入:全名、年龄和薪资。5.1. 全名(String类型):String name = scnx.nextLine(); 5.2. 年龄(简化处理为String):String age = scnx.nextLine(); 5.3. 薪资(简化处理为String):String salary = scnx.nextLine(); 输出格式化消息 使用连接来格式化输出消息。System.out.println(name + "is " + age + "and makes $ " + salary + ".");
5. **问题:能被3整除**
指令:如果一个数的数字之和能被3整除,则该数能被3整除。例如,153能被3整除,因为1 + 5 + 3 = 9,而9能被3整除。编写一个程序,收集表示三位数的三个整数输入。判断数字之和是否能被3整除。如果输入的任何一个整数是负值,则输出Invalid input!输出一个格式化信息,指明这个三位数是否能被3整除,并以换行符结束。确保你的程序输出与下面的示例格式匹配,并能适用于各种输入值。
输入:1 5 3
输出:153 is divisible by 3!
输入:1 0 4
输出:104 is not divisible by 3!
输入:1 -5 3
输出:Invalid input!
解决方案:import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String one = scnr.nextLine(); String two = scnr.nextLine(); String three = scnr.nextLine(); String sum = one + two + three; if (Integer.valueOf(one) < 0 || Integer.valueOf(two) < 0 || Integer.valueOf(three) < 0){ System.out.println("Invalid input!"); return; } int total = Integer.valueOf(sum); if (total % 3 == 0){ System.out.println(sum + " is divisible by 3!"); } else { System.out.println(sum + " is not divisible by 3!"); } } }
操作指导:导入必须的工具,首先导入 Scanner 类以便从用户那里获取输入。import java.util.Scanner; 定义你的类,在其中操作你的程序。public class LabProgram{ 主方法入口,每个Java程序从main方法开始执行。public static void main(String[] args) { 初始化 Scanner 对象,创建一个 Scanner 对象以读取用户的输入。Scanner scnr = new Scanner(System.in); 收集用户输入,获取代表位值的三个整数输入。百位:String one = scnr.nextLine(); 十位:String two = scnr.nextLine(); 个位:String three = scnr.nextLine(); 组合三个字符串创建三位数。String sum = one + two + three; 检查无效输入,如果输入的任何数字是负数,则为无效输入。if (Integer.valueOf(one) < 0 || Integer.valueOf(two) < 0 || Integer.valueOf(three) < 0){ System.out.println("Invalid input!"); return; 判断是否可以整除,将组合的字符串转换为一个整数。int total = Integer.valueOf(sum); 使用模运算符检查数字是否能被3整除。如果可以整除:if (total % 3 == 0) { System.out.println(sum + " is divisible by 3!"); 如果不可以整除:else { System.out.println(sum + " is not divisible by 3!");
6. **问题:姓名**
指令:编写一个程序,收集一个全名作为一个字符串输入。按下面显示的格式格式化并输出名字:lastInitial. firstName middleInitial.如果没有提供中间名,则按下面显示的格式格式化并输出名字:last Initial. firstName
输入:Pat Silly Doe
输出:D. Pat S.
输入:Julia Clark
输出:C. Julia
解决方案:public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String full_name = scnr.nextLine(); String[] parts = full_name.split(" "); String first_name = parts[0]; String last_name = parts[parts.length - 1]; String final_name = last_name.substring(01) + ". " + first_name; if (parts.length >2){ String middle = parts[1].substring(01); final_name += " " + middle + "."; } System.out.println(final_name); }
操作指导:初始化 Scanner 对象,首先导入 Scanner 类来读取用户的输入。Scanner scnr = new Scanner(System.in); 收集用户输入,作为一个字符串输入获取全名。String full_name = scnr.nextLine(); 分割名字,将全名分割成个别的名字部分(名,中名,姓)。String[] parts = full_name.split(" "); 根据分割后的字符串数组分配名和姓。String first_name = parts[0]; String last_name = parts[parts.length - 1]; 格式化初始输出,首先使用名和姓的首字母进行格式化。String final_name = last_name.substring(01) + ". " + first_name; 检查中间名,如果名字部分超过2个,说明存在中间名。提取其首字母并添加到输出中。if (parts.length > 2) { String middle = parts[1].substring(01); final_name += " " + middle + "."; 显示格式化后的名字,最后根据提供的输入打印格式化后的名字。System.out.println(final_name);
7. **问题:最小值及总和**
指令:编写一个程序,收集任意数量的非负整数输入,并计算这些值的总和。负整数应结束输入收集过程,并不计入总和中。输出非负输入值中的最小值和总和,并以换行符结束。确保你的程序输出与下面的示例格式匹配,并能适用于各种输入值。
输入:15 20 0 3 -1
输出:Smallest: 0 Sum: 38
解决方案:import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int smallest = Integer.MAX_VALUE; int sum = 0; while (true){ int num = scnr.nextInt(); if (num < 0){ break; } sum += num; if (num < smallest){ smallest = num; } } System.out.println("Smallest: " + smallest); System.out.println("Sum: " + sum); } }
操作指导:导入必须的工具,开始导入 Scanner 类以从用户那里获取输入。import java.util.Scanner; 定义你的类,在其内部进行你的程序操作。public class LabProgram { 主方法入口,每个 Java 程序都从main方法开始执行。public static void main(String[] args) { 初始化 Scanner 对象,创建一个 Scanner 对象来捕捉用户的输入。Scanner scnr = new Scanner(System.in); 初始化变量,smallest变量用于跟踪最小输入值,所以用最大的整数值进行初始化以便比较。int smallest = Integer.MAX_VALUE; sum用于跟踪输入的总和。int sum = 0; 开始输入收集循环,使用一个无限的while循环来持续捕捉用户输入,直到输入一个负数。while (true) { 收集用户输入,在循环内部从用户那里获取每个数。int num = scnr.nextInt(); 检查负输入,如果用户输入一个负数,则跳出循环。if (num < 0) { break; 计算总和,将当前数加到总和中。sum += num; 更新最小值,将当前数与smallest比较。如果它更小,更新smallest。if (num < smallest) { smallest = num; 展示结果,循环结束后(即获得负输入后)显示最小值和总和。System.out.println("Smallest: " + smallest); System.out.println("Sum: " + sum);
8. **问题:数组**
指令:编写一个程序创建一个数组,用于存放三个double类型的值。程序应收集三个double值作为输入并存储在数组中。然后计算数组的平均值。输出数组值和计算出的平均值,并以换行符结束。确保你的程序输出与下面的示例格式匹配,并能适用于各种输入值。
输入:10.0 10.5 11.0
输出:Array items: 10.0 10.5 11.0 Average: 10.5
解决方案:import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); double[] values = new double[3]; for (int i = 0; i < 3; i++) { values[i] = scnr.nextDouble(); } double sum = 0.0; for (double value : values) { sum += value; } double average = sum / 3.0; System.out.print("Array items: "); for (int i = 0; i < 3; i++) { System.out.print(values[i]); if (i < 2) { System.out.print(" "); } } System.out.println();How to use this prompt
- Review the pre-filled example and source files above.
- Copy the template or download
prompt-production-custom-gpt-custom-gpt-specification-1120.txt, then use it in your model, IDE, or workflow tool. - Compare your result with the sample output when one is provided.
Frequently Asked Questions
How do I use Prompt to Production Custom GPT: Custom GPT Specification 1120?
Open the prompt on Promptally, review the pre-filled example, then copy the template or download prompt-production-custom-gpt-custom-gpt-specification-1120.txt and paste it into your model, IDE or workflow tool. Prompt to Production Custom GPT: Custom GPT Specification 1120 is a static blueprint with no dynamic variables. Copy it and use it as-is.
Is Prompt to Production Custom GPT: Custom GPT Specification 1120 free?
Yes. Prompt to Production Custom GPT: Custom GPT Specification 1120 is free to view, copy and download on Promptally without creating an account. It is published under the MIT license.
What variables does Prompt to Production Custom GPT: Custom GPT Specification 1120 need?
Prompt to Production Custom GPT: Custom GPT Specification 1120 is a static blueprint with no dynamic variables. Copy it and use it as-is.